create app group to share database

fix widget layouts / calls
i think widgets work
This commit is contained in:
Trey t
2022-01-26 17:11:41 -06:00
parent 3739bc1aa1
commit 70f29199bb
6 changed files with 93 additions and 94 deletions

View File

@@ -190,12 +190,12 @@ class PersistenceController {
item()
}
}
private func setupContainer() -> NSPersistentContainer {
if useCloudKit {
container = NSPersistentCloudKitContainer(name: "Feels")
} else {
container = NSPersistentContainer(name: "Feels")
container = NSCustomPersistentContainer(name: "Feels")
}
for description in container.persistentStoreDescriptions {
@@ -274,3 +274,12 @@ extension NSManagedObjectContext {
NSManagedObjectContext.mergeChanges(fromRemoteContextSave: changes, into: [self])
}
}
class NSCustomPersistentContainer: NSPersistentContainer {
override open class func defaultDirectoryURL() -> URL {
var storeURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.88oak.ifeel")
storeURL = storeURL?.appendingPathComponent("Feels.sqlite")
return storeURL!
}
}