Created
October 20, 2018 04:17
-
-
Save laevandus/7e2611a0fe8d946587a36ba4bfb694f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class PersistentDataStore { | |
let name: String | |
private let dataStoreURL: URL | |
private let queue: DispatchQueue | |
init(name: String) throws { | |
self.name = name | |
queue = DispatchQueue(label: "com.augmentedcode.persistentdatastore", qos: .userInitiated, attributes: .concurrent, autoreleaseFrequency: .workItem) | |
let documentsURL = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false) | |
dataStoreURL = documentsURL.appendingPathComponent(name, isDirectory: true) | |
try FileManager.default.createDirectory(at: dataStoreURL, withIntermediateDirectories: true, attributes: nil) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment