Core Data

RSS for tag

Save your application’s permanent data for offline use, cache temporary data, and add undo functionality to your app on a single device using Core Data.

Posts under Core Data tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

MacOS App Core Data app is stuck in "This NSPersistentStoreCoordinator has no persistent stores (schema mismatch or migration failure). It cannot perform a save operation."
I work on a MacOS app (which has a companion iOS app) that uses Core Data with NSPersistentCloudKitContainer. The app also supports widgets and hence there is a need to migrate the persistent store within the core data stack using replacePersistentStore( at:.... During development I recently created a new model version and added a new entity, replaced some attributes etc... Working on the iOS app is fine because deleting the app clears all the data allowing me to work with a clean slate. On MacOS, I initially thought that I could simply navigate to the app group file location, delete the .sqlite file, along with the sqlite-shm and sqlite-wal. I also went and deleted the CloudKit related files. I did all of this out of pure ignorance - my expectation was that it would give me a clean slate, but it did not. This instead gave me some unpredictable behaviour, but the app was always in a bad state. the issues I saw were; • migration failure, • sqlite errors highlighting no such column: t0 - where all the new entity details were missing in sqlite completely After finding a post in the forums about how to reset macOS correctly, I did this instead - do { try container.persistentStoreCoordinator.destroyPersistentStore(at: container.persistentStoreDescriptions.first!.url!, type: .sqlite, options: nil) try container.persistentStoreCoordinator.destroyPersistentStore(at: storeURL, type: .sqlite, options: nil) } catch { print(String(describing: error)) } And now I am back to the ongoing error of This NSPersistentStoreCoordinator has no persistent stores (schema mismatch or migration failure). It cannot perform a save operation. Another thing to note - whenever running the destroyPersistentStore( I have tried this on both the URLs of the old store location and the new one (in the app group). This still doesn't seem to help. AND I noticed that while destroyPersistentStore does get rid of the .sqlite file, it does not delete the sqlite-shm and sqlite-wal - could this be the problem? and do I need to delete these manually? public class CoreDataManager { public static let shared = CoreDataManager() private enum Constants { #if os(macOS) static let appGroupName = "2MM2V2959F.wabitime.group" #elseif os(iOS) static let appGroupName = "group.wabitime" #endif static let containerName = "WabiTimeDataModel" /// The name of the sql database file static let databaseName = "wabitime_database" /// The identifier for the container static let containerIdentifier = "iCloud.com.jslomowitz.WabiTime" } public lazy var context = persistentContainer.viewContext lazy var managedObjectModel: NSManagedObjectModel = { guard let wabiDataBundle = Bundle.module.url( forResource: Constants.containerName, withExtension: "momd" ), let managedObjectModel = NSManagedObjectModel(contentsOf: wabiDataBundle) else { assertionFailure("cannot find managedObjectModel") return NSManagedObjectModel() } return managedObjectModel }() lazy var persistentContainer: NSPersistentCloudKitContainer = { let container = NSPersistentCloudKitContainer( name: Constants.containerName, managedObjectModel: managedObjectModel ) /// URL of the old sql database that has not been relocated to the app group var oldStoreURL: URL? { guard let storeDescription = container.persistentStoreDescriptions.first, let url = storeDescription.url, FileManager.default.fileExists(atPath: url.path) else { return nil } return url } /// URL of the sql database in the app group var storeURL: URL { guard let fileContainer = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: Constants.appGroupName) else { fatalError("Shared file container could not be created") } return fileContainer.appendingPathComponent("\(Constants.databaseName).sqlite") } // assign the shared container if the old store has been deleted if oldStoreURL == nil { let description = NSPersistentStoreDescription(url: storeURL) description.shouldInferMappingModelAutomatically = true description.shouldMigrateStoreAutomatically = true container.persistentStoreDescriptions = [description] } // perform store migration if necessary if let url = oldStoreURL, url.absoluteString != storeURL.absoluteString { let coordinator = container.persistentStoreCoordinator do { let storeOptions = [ NSMigratePersistentStoresAutomaticallyOption: true, NSInferMappingModelAutomaticallyOption: true ] try coordinator.replacePersistentStore( at: url, withPersistentStoreFrom: storeURL, sourceOptions: storeOptions, type: .sqlite ) } catch { print(error.localizedDescription) } self.deleteOldStore(with: url) } let options = NSPersistentCloudKitContainerOptions(containerIdentifier: Constants.containerIdentifier) guard let description = container.persistentStoreDescriptions.first else { fatalError("Could not retrieve a persistent store description.") } description.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey) description.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey) description.cloudKitContainerOptions = options container.loadPersistentStores(completionHandler: { [weak self] (_, error) in guard let self, error == nil else { assertionFailure("Unresolved error: \(String(describing: error))") return } }) container.viewContext.automaticallyMergesChangesFromParent = true container.viewContext.mergePolicy = NSMergePolicy(merge: .mergeByPropertyObjectTrumpMergePolicyType) return container }() private func deleteOldStore(with url: URL) { let fileCoordinator = NSFileCoordinator() fileCoordinator.coordinate(writingItemAt: url, options: .forDeleting, error: nil) { url in do { try FileManager.default.removeItem(at: url) } catch { print(error.localizedDescription) } } } // MARK: - Core Data Saving and Undo support func saveContext(completion: (() -> Void)? = nil) { #if os(macOS) if !context.commitEditing() { NSLog("AppDelegate unable to commit editing before saving") } #endif if context.hasChanges { do { try context.save() print("SAVED") completion?() } catch { let nserror = error as NSError #if os(macOS) NSApplication.shared.presentError(nserror) #endif } } } }
2
1
503
Nov ’23
SwiftData - different containers in one app
Hello to team, I have a very challenging issue that I'm not able to fix. I have an app that works with SwiftData Model Container that is generated when the app is launched. In the app I also added a Demo Mode area, where the user can load a mock data and simulating app behavior with more data. In order to switch to demo mode, I'm loading new UI layer and loading a new model container, which is configured to work with the same scheme, but isStoredInMemoryOnly = true. Everything works fine. Now, when the user toggles off the demo mode and go back to the main UI, any persistent changes to the modelContext leads to a crash where it says that the create store is different from the open store. Tried almost everything - I'm not sure even if it's possible to have this flow with SwiftData, butI'm trying. Please advice. Thanks a lot!
0
1
560
Nov ’23
Core Data error: 'cannot use an attribute type of "Composite"' when "Used with CloudKit" checked
Hello, I'm running into an odd error. I'm trying to add a composite attribute called period to a Core Data Entity named Report, but I'm getting a compile-time error that points to my xcdatamodel file: Report.period cannot use an attribute type of "Composite". In my model configuration I have "Used with CloudKit" box checked. If I uncheck this box, the error goes away and everything builds fine. But the documentation for NSCompositeAttributeDescription says: You may use composite attributes anywhere you use standard attributes, including lightweight migrations and CloudKit, through NSPersistentCloudKitContainer. So it seems like I should be able to use composite attributes in Core Data with CloudKit syncing enabled. What am I missing here? Is this a bug, or am I doing something wrong?
2
0
326
Oct ’23
Xcode 15: Core Data : No NSValueTransformer with class name *** was found for attribute YYY on entity ZZZ for custom `NSSecureUnarchiveFromDataTransformer`
Hi, I am creating a custom NSSecureUnarchiveFromDataTransformer in order to handle attributes of entities of type NSDateComponents. It all works and I did not see any warnings in the "Issue navigator" inside Xcode but with Xcode 15 I started seeing this warning: /Users/.../CustomNSSecureUnarchiveFromDataTransformer/CoreData:1:1 no NSValueTransformer with class name 'CustomSecureUnarchiveFromDataTransformer' was found for attribute 'testDate' on entity 'Item' My use case is very simple, I have this custom transformer: @objc(CustomSecureUnarchiveFromDataTransformer) final class CustomSecureUnarchiveFromDataTransformer: NSSecureUnarchiveFromDataTransformer { override class var allowedTopLevelClasses: [AnyClass] { return [NSDateComponents.self] } static let name = NSValueTransformerName(rawValue: String(describing: CustomSecureUnarchiveFromDataTransformer.self)) public static func register() { let transformer = CustomSecureUnarchiveFromDataTransformer() ValueTransformer.setValueTransformer(transformer, forName: name) } } which is set to the Core data entity's "Transformer": which leads to the warning in Xcode 15. App works just fine and there are no problems during run time, but this warning is shown and I want to fix it. Here is a simple test project https://github.com/VladimirAmiorkov/CustomNSSecureUnarchiveFromDataTransformer
12
10
2.2k
8h
new swift concurrency model with core data willSave()
anyone know how to use the new swift concurrency model (ie. await context.perform and context.perform) core data willSave()? for example. how would I ensure this is thread safe? changing self.managedObjectContext!.performAndWait to await self.managedObjectContext!.perform means I have to change willSave() to async which then means it never gets called because its not overriding the correct method anymore. override public func willSave() { self.managedObjectContext!.performAndWait { if self.modifiedDate == nil || Date().timeIntervalSince(self.modifiedDate!) >= 1 { self.modifiedDate = Date() } } super.willSave() }
0
0
550
Oct ’23
Designing a Word of the Day App: Balancing Local Word Data with Cloud-Based Learning Records"
I have a "Word of the Day" application with a CoreData database containing approximately 14,000 word entities. These entities have attributes like frequency (indicating how often a word appears in some corpus), definition, and pronunciation. Currently, this information is stored locally. I want to add a feature that allows users to store their learning data about these words. For example, users should be able to mark words with a rating of 1, 2, or 3 to indicate their degree of familiarity with the words. My ultimate goal is to display the highest-frequency word with a user familiarity rating of 1 and display it as todays word of the day. The challenge I'm facing is how to set up my app so that learning data is stored in the cloud while the word information remains stored locally. I've seen that you can create different configurations and have one connected to CloudKit, but this approach may make it difficult to write queries that combine information from both the Word entity and the LearningData entity. I'm looking for suggestions on how to address this issue effectively.
0
0
272
Oct ’23
In CloudKit, how do I check whether the user of an app is the share-sender or the share-receiver?
In other words, I’m trying to setup sharing in my app using Core Data with CloudKit. Basically the user can share their list of CloudKit records with other users of the app. Should that other user accept that share from that share-sender, the share-receiver can then sees the sender’s list of records. This part works as I need it to. This is fine. As well, the app is largely being written in SwiftUI. However, what I also need is to give the user the ability to see only their own records, or to set one of their records to private. I think I can figure this logic out, but I’m still not sure of how to filter the sender versus receiver of that share, AKA owner vs participant. I’ve tried several things to figure this out, and I keep coming up empty. I feel like there’s a good way to do this, however what I’ve done always has issues. Can someone please describe the best way to do this?
0
0
383
Oct ’23
Receiving NSPersistentStoreRemoteChange notification when app is closed
I use NSPersistentCloudKitContainer to fetch/sync data across multiple devices with the same iCloud account. /// ... container = NSPersistentCloudKitContainer(name: containerName) let description = container.persistentStoreDescriptions.first description?.setOption( true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey) description?.setOption( true as NSNumber, forKey: NSPersistentHistoryTrackingKey) let viewContext = container.viewContext viewContext.automaticallyMergesChangesFromParent = true viewContext.mergePolicy = NSMergePolicy.mergeByPropertyObjectTrump NotificationCenter.default.addObserver( forName: .NSPersistentStoreRemoteChange, object: container.persistentStoreCoordinator, queue: .main ) { _ in Task { @MainActor [weak self] in // fetch new data and update widgets with it // ... viewContext.fetch ... // WidgetCenter.shared.reloadAllTimelines() } } } /// ... Everything works fine when my app in the foreground. How can I achieve the same when my app is closed/ in the background? I know that CloudKit can send silent push notification which can wake up my app but I've never seen the implementation of it using CoreData NSPersistentCloudKitContainer
0
0
402
Oct ’23
Swiftdata: CloudKit integration requires that all attributes be optional, or have a default value set
Unfortunately I can not get swiftdata to work for me. I created a brand new project in Xcode, modified no code and the program fails with this error. Only thing I did was add an iCloud container. The default code that you are given for a swiftadata object is: @Model final class Item { var timestamp: Date init(timestamp: Date) { self.timestamp = timestamp } } Xcode wants that values in this model to ether be optional or have a default value. I thought this was a bug that had been fixed, but I am on the latest Xcode. I am not sure how to proceed. If the default code Xcode gives you won't compile, how am I able to code my own?
1
0
498
Oct ’23
Core Data query for Transformable
Hi, in my Core Data model, I’m using Transformable to store values of different kinds to the same attribute (I’m creating a user generated filter for data, that could filter for Integers, Boolean or other values - to avoid creating attributes for each possible types i‘m using transformable Any). now, while querying for these values, I’ve noticed that this attribute is never correctly evaluated, but is always false. is it possible to query for Transformable or do I need to change my approach and create an attribute for each possible Type?
0
0
301
Oct ’23
App structure for iOS app, widgets, watchOS app & complications?
I've had to rewrite my app to get widgets working properly, and I've got this project structure: Main iOS app: Bundle identifier = com.me.myapp Contains: Widget Extension: Bundle identifier = com.me.myapp.widgets Targets iOS 17 Provides widgets to iOS Watch app: Bundle identifier = com.me.myapp.watchapp Contains: Complications Extension (a Widget Extension): Bundle identifier = com.me.myapp.watchapp.complications Targets watchOS 10 Provides widgets to watchOS On the Signing & Capabilities tab in Xcode 15, all four targets have: Provisioning Profile: Xcode Managed Profile Signing Certificate: Apple Development: My team App Groups: all use the same one: group.com.me.myapp I can build and deploy to a physical iPhone and Apple Watch, but the Watch app doesn't seem to be able to access the shared Core Data, which should be in the shared app group container. When running the main iOS app, the store location is: file:///private/var/mobile/Containers/Shared/AppGroup/189E5907-E6E4-4790-833F-06944E4FF5FF/data-model/TheDataModel When running the widget extension, the store location is: file:///private/var/mobile/Containers/Shared/AppGroup/189E5907-E6E4-4790-833F-06944E4FF5FF/data-model/TheDataModel When I run the Watch app, the store location is different: file:///private/var/mobile/Containers/Shared/AppGroup/55381E6D-410E-4322-93BA-64BD1933909E/data-model/TheDataModel How do I get the Watch app to see the Core Data store from the main app? Do I have to replicate the store to that location every time something changes in the main app? Or do I have to go back to sending massive data sets as dictionaries/data via WatchConnectivity?
1
0
872
Oct ’23
Access iOS app CoreData in Swift extension?
This should be simple, but it's proving immensely difficult and annoying. I have three targets in the project: an iOS app written in Objective-C a Watch App written in Swift/SwiftUI a Widget Extension with my widgets and complications in, written in Swift/SwiftUI I want to access the Core Data that's got all my app's data in it from the Widget Extension and Watch App. How do I do this? Every internet search result assumes all your targets are in Swift, and it's really not feasible for me to rewrite the entire app. All three targets have the same App Group set up, and I can access UserDefaults in each target. I have a CoreData.swift class in a shared folder, and it's a member of both the Watch App and Widget Extension targets. It has this in it: lazy var persistentContainer: NSPersistentContainer = { let storeURL = URL.storeURL(for: kAppGroup, databaseName: kCoreDataModel) let storeDescription = NSPersistentStoreDescription(url: storeURL) let container = NSPersistentContainer(name: kCoreDataModel) container.persistentStoreDescriptions = [storeDescription] container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { fatalError("CoreData: Failed to initialise Managed Object Model from url: \(storeURL), with error: \(error), \(error.userInfo)") } }) return container }() and the storeURL extension is: public extension URL { static func storeURL(for appGroup: String, databaseName: String) -> URL { guard let fileContainer = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroup) else { fatalError("CoreData: Shared file container could not be created.") } return fileContainer.appendingPathComponent("\(kCoreDataModel).sqlite") } } To be clear, the main iOS app (in Objective-C) has created the Core Data model etc., and it all works fine. I just want to be able to access the data in that model from the other targets. (I only need read access.) When I deploy to a device the stack looks like this: NSURL *dataModelFolderURL = [[[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:kAppGroup] URLByAppendingPathComponent:kCoreDataFolder]; Is: /private/var/mobile/Containers/Shared/AppGroup/9F329A90-C897-4AA2-87DF-D98A9E85356A/data-model NSURL *modelURL = [[NSBundle mainBundle] URLForResource:kCoreDataModel withExtension:@"momd"]; Is: file:///private/var/containers/Bundle/Application/CA9E3697-C4C6-48CB-89EA-CC441A6F81AF/MyApp.app/TheDataModel.momd/ // Wait until we have the store, or fetches will sometimes return no data [self performSelectorOnMainThread:@selector(getStore) withObject:nil waitUntilDone:YES]; storeURL = file:///private/var/mobile/Containers/Shared/AppGroup/9F329A90-C897-4AA2-87DF-D98A9E85356A/data-model/TheDataModel I've tried getting the Swift targets to look in a bunch of different paths, but nothing works. When I try to get a count of objects in the Core Data I always get zero results. The second of those outputs is from the bundle. I guess that's because the data model is held within the iOS app's structure? Does that make any difference? Should it be held somewhere else? If so, what should it be? (Minor rant: There really should be an option in Xcode that says, "This core data is shared here, here and here, and all you need to do is type CoreData.getSomeData() and you're done", but no, we have to write boilerplate code for everything.) Anyway... any help is appreciated.
1
0
524
Oct ’23
Core Data: Merging relevant changes between extensions and iCloud devices
I am working on an interactive widget and merging changes provided by a user over it with the app. I store my data, using Core Data. However, I noticed an issue with sync between other user's devices after that person made a change over the widget (in my case, it is completing a task). Here is my schema: Main app: it looks for relevant transactions (https://developer.apple.com/documentation/coredata/consuming_relevant_store_changes). When it found that one, the app merges changes: if transaction.author == "widget" { if let userInfo = transaction.objectIDNotification().userInfo { NSManagedObjectContext.mergeChanges(fromRemoteContextSave: userInfo, into: [taskContext]) } } Widget: If the user clicks on the checkbox in order to complete a task, using an AppIntent class, app creates an identical NSPersistentCloudKitContainer and completes the task. However, in that case, the NSPersistentCloudKitContainer of the widget does not look for changes. That works correctly. However, only in a local environment. Here's why: If I complete a task (using a widget) and launch the app on the same device, the change will be synced correctly. If I complete a task (using a widget) (on device A) and launch the app on another device (on device B), the change will not be applied (on device B), until I open the app on the device that I made the change on (on device A). If I open the app on device B after I opened it on device A (and the changed has been applied), on device A I get a remote notification with the author value = 'NSCloudKitMirroringDelegate.import', not 'widget'. The point of my issue is that the remote notifications about changes made, using widgets, does not arrive to other devices like notifications initialised by the main app. Thank you in advance!
1
1
546
Nov ’23
CloudKit stopped syncing on WatchOS
Hey, I have an iOS/watchOS application that has been in the App Store since the beginning of last year (for reference: https://endsplus.com). Part of the functionality includes: Create a Fixture on the Phone Create Fixture on iOs Fixture is saved to Core Data Core Data syncs with CloudKit WatchOs pulls down the record, updating a table of the same name I can show the Fixtures on the Watch. Track a game on the Watch and then save it. Create a Game on WatchOS Game is saved to Core Data Core Data syncs with CloudKit iOS pulls down the record, updating a table of the same name I can show the games on the phone. For reasons I am unable to work out syncing of core data tables between the phone and the watch has stopped working. I know that the iOS coredata/cloudkit functionality is working as I can create a record on my physical phone, then run a simulator and log in with the same iCloud account and see the record. But the functionality has stopped working for watchOS. I have added a new table to the Watch side that is not syncing to the Phone, but an existing table (Fixture) that has been working has also stopped syncing between the phone and the watch. None of my Persistence/Core Data code has changed. My new table is associated with a Cloud Store, the same as my old table is. What options are they available to me to try and debug this. The watchOs simulator doesn't seem to work with CloudKit, telling me it is not signed in. I've tried looking at the CloudKit database logs, but obviously for security I can't see the data, but I can't see any errors from the watch. I've uninstalled and re-installed the application (on the phone and the watch) numerous times, but that isn't working. Does anyone have any ideas? Thanks
4
0
603
Oct ’23
NSPersistentStoreCoordinator crash (routeHeavyweightBlock?)
Hello, I recently published an app on the App Store. I see a crash log from one of my users, but don't understand the reason CoreData crashed. It was simply saving a single object, and all the properties of it are optional. I am unable to reproduce the crash, and in the over 8 moths of development before release, I did not encounter this type of error. Please provide assistance, or where I could do some more research. I included part of the crash log below. Thank you very much. Hardware Model: iPhone15,4 Process: Proaneer Version: 1.0.3 (50) AppStoreTools: 15A240a AppVariant: 1:iPhone15,4:17 Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd [1] Date/Time: 2023-10-01 09:14:05.6888 -0400 Launch Time: 2023-10-01 09:08:34.4421 -0400 OS Version: iPhone OS 17.0.2 (21A350) Release Type: User Baseband Version: 1.00.03 Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: SIGNAL 6 Abort trap: 6 Terminating Process: Proaneer Triggered by Thread: 0 Last Exception Backtrace: 0 CoreFoundation 0x19a4565e0 __exceptionPreprocess + 164 (NSException.m:249) 1 libobjc.A.dylib 0x192767c00 objc_exception_throw + 60 (objc-exception.mm:356) 2 CoreData 0x1a2609410 -[NSPersistentStoreCoordinator _introspectLastErrorAndThrow] + 120 (NSPersistentStoreCoordinator.m:0) 3 CoreData 0x1a24f3fbc __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke.541 + 680 (NSPersistentStoreCoordinator.m:0) 4 CoreData 0x1a24f3c2c -[NSPersistentStoreCoordinator _routeHeavyweightBlock:] + 264 (NSPersistentStoreCoordinator.m:641) 5 CoreData 0x1a24d05b4 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1048 (NSPersistentStoreCoordinator.m:2768) 6 CoreData 0x1a24d05d8 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1084 (NSPersistentStoreCoordinator.m:3425) 7 CoreData 0x1a24c1e84 -[NSManagedObjectContext save:] + 972 (NSManagedObjectContext.m:1625) 8 Proaneer 0x102f2e268 ContactListViewModel.saveContact(functionName:functionAction:count:) + 96 (ContactListViewModel + CRUD Ext..swift:151) 9 Proaneer 0x102f2e1e4 ContactListViewModel.createContact() + 2496 (ContactListViewModel + CRUD Ext..swift:50) 10 Proaneer 0x102f7e08c closure #1 in closure #1 in closure #2 in closure #1 in closure #5 in ContactListRootView.body.getter + 84 (ContactListRootView.swift:203)
1
1
341
Oct ’23
Saving to Core Data during device locking & unlocking
The following error message "SIGABRT: This NSPersistentStoreCoordinator has no persistent stores (device locked). It cannot perform a save operation" has indicated need to provide for sequencing of the Core Data context saving operation. We want to avoid .save() if locking is in flight, also postpone .save() until unlocking has completed. Currently our .save() is bracket by do-catch block but this is notably not helping in the case of SIGABR signal Given that our saving operations must take place synchronously, what is the recommended practice to implement such sequencing with respect to locking / unlocking
0
0
300
Sep ’23
Fetch recurring objects using CoreData predicate
Hello! I was wondering if there's any open source example how to implement SUBQUERY in CoreData in calendar based app? For example: User creates an event with subtasks on the 1st on September with daily frequency On the 5th of September they update just that day event's details, some subtasks. On the 7th of September they see the same event that was created on the 1st of September. Structs that can describe the case may look like this: enum Frequency { case daily case weekly case monthly } struct Subtask { var name: String var isCompleted: Bool } struct Event { var id: UUID var name: String var startAt: Date var repeatUntil: Date? var isCompleted: Bool var subtasks: [Subtask] var frequency: Frequency? var excludedOn: [Date] } For each day on a week I need to fetch events from CoreData, so I'm wondering how predicate can look like in such case? I met SUBQUERY, but I'm not sure how to apply weekly and monthly frequency frequency into NSPredicate (for daily it's pretty straightforward). Would be glad for any advices! ~Paul
0
0
258
Sep ’23