Post

Replies

Boosts

Views

Activity

Reply to List Cell - Modifying associated object causes reload of whole list
On loading the view I get ProjectEditColourListView: @self, @identity, _viewContext, _editMode, _colourList, @64, @88, _searchText, _isShowingFilterView, _appSetting, _filters changed. ProjectEditColourListView: @self changed. ProjectEditColourListView: @88 changed. Then after selecting a cell ProjectEditColourListView: @88 changed. ProjectEditColourListView: @self changed. ProjectEditColourListView: @88 changed. ProjectEditColourListView: @self changed. ProjectEditColourListView: @self changed.
5d
Reply to Filtered list when going back from pushed view
Seems like I can alter the onAppear method to do what I want .onAppear() {             items.nsPredicate = NSPredicate(format: "series = %@ AND amount = 0", series)             if(!searchText.isEmpty) {                 items.nsPredicate = NSPredicate(format: "series = %@ AND amount = 0 AND name CONTAINS[cd] %@", series, searchText)             }         }
May ’22
Reply to Syncing key values between devices
OK, so I can see that the notification is being fired and the value is being changed but the notification appears to be fired after the initial import is done. From the notification NSLog("First Run: \(String(describing: notification.userInfo))") First Run: Optional([AnyHashable("NSUbiquitousKeyValueStoreChangedKeysKey"): <__NSArrayM 0x60000391c450>( firstRun, timeGrouping, imageThumbSize, dbVersion ) , AnyHashable("NSUbiquitousKeyValueStoreChangeReasonKey"): 1]) Launching the application func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 		appData.moc = persistentContainer.viewContext 		NotificationCenter.default.addObserver(self, selector: #selector(onUbiquitousKeyValueStoreDidChangeExternally(notification:)), name: NSUbiquitousKeyValueStore.didChangeExternallyNotification, object: NSUbiquitousKeyValueStore.default) 		performUpdates() 		return true } and the performUpdates function 		func performUpdates() {         let firstRunPref: Bool = prefs.bool(forKey: "firstRun")         let firstRun: Bool = keyValStore.bool(forKey: "firstRun")         if(!firstRun) {             // Check for old prefs, if existing, there is already data in the db             if(!firstRunPref) {                 // No previous data                 keyValStore.set(true, forKey: "firstRun")                 NSLog("First Run: Yes inital keyval, no prefs, initial import")             } else {                 // Previous data exists                 keyValStore.set(true, forKey: "firstRun")                 NSLog("First Run: Yes inital keyval, previous prefs, convert")             }         } else {             updates(useKeyVal: true)             NSLog("First Run: No, update")         }     }
Jul ’20