mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-24 18:31:17 +01:00
WIP: demo app
This commit is contained in:
@@ -57,7 +57,6 @@ public class ICloudStore: CloudStorage {
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
- parameter ubiquitousContentName: the name of the store in iCloud. This is required and should not be empty, and should not contain periods (`.`).
|
||||
- parameter ubiquitousContentTransactionLogsSubdirectory: an optional subdirectory path for the transaction logs
|
||||
- parameter ubiquitousContainerID: a container if your app has multiple ubiquity container identifiers in its entitlements
|
||||
@@ -481,8 +480,8 @@ public class ICloudStore: CloudStorage {
|
||||
|
||||
guard let `self` = self,
|
||||
let observer = observer,
|
||||
let dataStack = note.userInfo?[String(DataStack.self)] as? DataStack
|
||||
where self.dataStack === dataStack else {
|
||||
let dataStack = note.userInfo?[String(DataStack.self)] as? DataStack,
|
||||
self.dataStack === dataStack else {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
|
||||
import Foundation
|
||||
import CoreData
|
||||
#if USE_FRAMEWORKS
|
||||
import GCDKit
|
||||
#endif
|
||||
|
||||
|
||||
// MARK: - LegacySQLiteStore
|
||||
@@ -180,7 +183,29 @@ public final class LegacySQLiteStore: LocalStorage, DefaultInitializableStore {
|
||||
options: [NSSQLitePragmasOption: ["journal_mode": "DELETE"]]
|
||||
)
|
||||
try journalUpdatingCoordinator.remove(store)
|
||||
try FileManager.default.removeItem(at: fileURL)
|
||||
|
||||
let fileManager = FileManager.default
|
||||
do {
|
||||
|
||||
let temporaryFile = try URL(fileURLWithPath: NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).first!)
|
||||
.appendingPathComponent(Bundle.main.bundleIdentifier ?? "com.CoreStore.DataStack", isDirectory: true)
|
||||
.appendingPathComponent("trash", isDirectory: true)
|
||||
.appendingPathComponent(UUID().uuidString, isDirectory: false)
|
||||
try fileManager.createDirectory(
|
||||
at: try temporaryFile.deletingLastPathComponent(),
|
||||
withIntermediateDirectories: true,
|
||||
attributes: nil
|
||||
)
|
||||
try fileManager.moveItem(at: fileURL, to: temporaryFile)
|
||||
GCDQueue.background.async {
|
||||
|
||||
_ = try? fileManager.removeItem(at: temporaryFile)
|
||||
}
|
||||
}
|
||||
catch {
|
||||
|
||||
try fileManager.removeItem(at: fileURL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
//
|
||||
|
||||
import CoreData
|
||||
#if USE_FRAMEWORKS
|
||||
import GCDKit
|
||||
#endif
|
||||
|
||||
|
||||
// MARK: - SQLiteStore
|
||||
@@ -177,7 +180,29 @@ public final class SQLiteStore: LocalStorage, DefaultInitializableStore {
|
||||
options: [NSSQLitePragmasOption: ["journal_mode": "DELETE"]]
|
||||
)
|
||||
try journalUpdatingCoordinator.remove(store)
|
||||
try FileManager.default.removeItem(at: fileURL)
|
||||
|
||||
let fileManager = FileManager.default
|
||||
do {
|
||||
|
||||
let temporaryFile = try URL(fileURLWithPath: NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).first!)
|
||||
.appendingPathComponent(Bundle.main.bundleIdentifier ?? "com.CoreStore.DataStack", isDirectory: true)
|
||||
.appendingPathComponent("trash", isDirectory: true)
|
||||
.appendingPathComponent(UUID().uuidString, isDirectory: false)
|
||||
try fileManager.createDirectory(
|
||||
at: try temporaryFile.deletingLastPathComponent(),
|
||||
withIntermediateDirectories: true,
|
||||
attributes: nil
|
||||
)
|
||||
try fileManager.moveItem(at: fileURL, to: temporaryFile)
|
||||
GCDQueue.background.async {
|
||||
|
||||
_ = try? fileManager.removeItem(at: temporaryFile)
|
||||
}
|
||||
}
|
||||
catch {
|
||||
|
||||
try fileManager.removeItem(at: fileURL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user