diff --git a/Feels (iOS).entitlements b/Feels (iOS).entitlements index 2ead4a3..95edbee 100644 --- a/Feels (iOS).entitlements +++ b/Feels (iOS).entitlements @@ -6,7 +6,7 @@ development com.apple.developer.icloud-container-identifiers - iCloud.com.88oak.feels + iCloud.com.88oak.ifeel com.apple.developer.icloud-services diff --git a/Feels (iOS)Dev.entitlements b/Feels (iOS)Dev.entitlements index 6a36e63..95edbee 100644 --- a/Feels (iOS)Dev.entitlements +++ b/Feels (iOS)Dev.entitlements @@ -6,7 +6,7 @@ development com.apple.developer.icloud-container-identifiers - iCloud.com.88oak.feelsDebug + iCloud.com.88oak.ifeel com.apple.developer.icloud-services diff --git a/Shared/Feels.xcdatamodeld/Shared.xcdatamodel/contents b/Shared/Feels.xcdatamodeld/Shared.xcdatamodel/contents index 652bae8..64afd9a 100644 --- a/Shared/Feels.xcdatamodeld/Shared.xcdatamodel/contents +++ b/Shared/Feels.xcdatamodeld/Shared.xcdatamodel/contents @@ -1,12 +1,14 @@ + + - + \ No newline at end of file diff --git a/Shared/FeelsApp.swift b/Shared/FeelsApp.swift index 0bc183a..dc27ba9 100644 --- a/Shared/FeelsApp.swift +++ b/Shared/FeelsApp.swift @@ -41,4 +41,5 @@ struct FeelsApp: App { } } } + } diff --git a/Shared/Persistence.swift b/Shared/Persistence.swift index 21adb8e..43826a1 100644 --- a/Shared/Persistence.swift +++ b/Shared/Persistence.swift @@ -46,6 +46,8 @@ class PersistenceController { newItem.moodValue = Int16(mood.rawValue) newItem.forDate = date newItem.weekDay = Int16(Calendar.current.component(.weekday, from: date)) + newItem.canEdit = true + newItem.canDelete = true do { try viewContext.save() @@ -99,6 +101,8 @@ class PersistenceController { let newItem = MoodEntry(context: viewContext) newItem.timestamp = Date() newItem.moodValue = Int16(Mood.allValues.randomElement()!.rawValue) + newItem.canEdit = true + newItem.canDelete = true let date = Calendar.current.date(byAdding: .day, value: -idx, to: Date())! newItem.forDate = date @@ -119,6 +123,8 @@ class PersistenceController { let newItem = MoodEntry(context: viewContext) newItem.timestamp = Calendar.current.date(byAdding: .day, value: -idx, to: Date()) newItem.moodValue = Int16(Mood.allValues.randomElement()!.rawValue) + newItem.canEdit = true + newItem.canDelete = true let date = Calendar.current.date(byAdding: .day, value: -idx, to: Date())! newItem.forDate = date @@ -173,6 +179,8 @@ class PersistenceController { let date = Calendar.current.date(byAdding: .day, value: -idx, to: Date())! newItem.forDate = date newItem.weekDay = Int16(Calendar.current.component(.weekday, from: date)) + newItem.canEdit = true + newItem.canDelete = true entries.append(newItem) } return entries @@ -185,12 +193,7 @@ class PersistenceController { if inMemory { container.persistentStoreDescriptions.first!.url = URL(fileURLWithPath: "/dev/null") } - container.viewContext.automaticallyMergesChangesFromParent = true - for description in container.persistentStoreDescriptions { - description.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey) - description.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey) - } container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { @@ -208,6 +211,13 @@ class PersistenceController { fatalError("Unresolved error \(error), \(error.userInfo)") } }) + + container.viewContext.automaticallyMergesChangesFromParent = true + + for description in container.persistentStoreDescriptions { + description.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey) + description.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey) + } } diff --git a/Shared/views/ContentView.swift b/Shared/views/ContentView.swift index ac894df..d055806 100644 --- a/Shared/views/ContentView.swift +++ b/Shared/views/ContentView.swift @@ -171,7 +171,6 @@ struct ContentView: View { Text(dayFormat(fromDate:entry.forDate!)) .font(.title3) .foregroundColor(Color(UIColor.label)) - Spacer() } .multilineTextAlignment(.leading)