|
| 1 | +// CoordinatedFileTransiting.swift |
| 2 | +// Copyright (c) 2014 Mutual Mobile (http://www.mutualmobile.com/) |
| 3 | +// Created by Vance Will (vancewilll@icloud.com). |
1 | 4 | // |
2 | | -// CoordinatedFileTransiting.swift |
| 5 | +// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 | +// of this software and associated documentation files (the "Software"), to deal |
| 7 | +// in the Software without restriction, including without limitation the rights |
| 8 | +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 9 | +// copies of the Software, and to permit persons to whom the Software is |
| 10 | +// furnished to do so, subject to the following conditions: |
3 | 11 | // |
| 12 | +// The above copyright notice and this permission notice shall be included in |
| 13 | +// all copies or substantial portions of the Software. |
4 | 14 | // |
5 | | -// Created by Ethan Mengoreo on 2021/2/3. |
6 | | -// |
| 15 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 21 | +// THE SOFTWARE. |
7 | 22 |
|
8 | | -import Foundation |
9 | 23 | import AnyCodable |
| 24 | +import Foundation |
10 | 25 |
|
11 | 26 | /// This class inherits from the default implementation of the MMWormholeTransiting protocol and implements message transiting in a similar way but using NSFileCoordinator for its file reading and writing. |
12 | 27 | public class CoordinatedFileTransiting: FileTransiting { |
13 | | - |
14 | 28 | /// The default file writing option is `Data.WritingOptions.atomic`. It may be important for your app to use |
15 | 29 | /// additional file writing options to control the specific data protection class for message files |
16 | 30 | /// being written by your application. When you create your file transiting object, set this property |
17 | 31 | /// to the additional writing options you want to use. |
18 | 32 | public var additionalDataWritingOptions = Data.WritingOptions.atomic |
19 | 33 |
|
20 | | - public override func writeMessage<T: Codable>(_ message: T?, for identifier: String) -> Bool { |
| 34 | + override public func writeMessage<T: Codable>(_ message: T?, for identifier: String) -> Bool { |
21 | 35 | guard let message = message else { |
22 | 36 | // just notification |
23 | 37 | return true |
@@ -48,7 +62,7 @@ public class CoordinatedFileTransiting: FileTransiting { |
48 | 62 | return (error == nil) && succeeded |
49 | 63 | } |
50 | 64 |
|
51 | | - public override func message(for identifier: String) -> Any? { |
| 65 | + override public func message(for identifier: String) -> Any? { |
52 | 66 | guard let fileURL = fileDirectory(for: identifier) else { |
53 | 67 | return nil |
54 | 68 | } |
|
0 commit comments