London Escorts sunderland escorts 1v1.lol unblocked yohoho 76 https://www.symbaloo.com/mix/yohoho?lang=EN yohoho https://www.symbaloo.com/mix/agariounblockedpvp https://yohoho-io.app/ https://www.symbaloo.com/mix/agariounblockedschool1?lang=EN
-1.1 C
New York
Sunday, February 2, 2025

ios – Including information to Core Knowledge if there isn’t a information on gadget and no information in iCloud


For an app I am constructing I need to setup the app for the consumer when opening the app for the primary time. This implies creating an inventory (ListEntity) in Core Knowledge. I do that within the persistence controller. (I take advantage of the auto generated controller by Xcode).

The app makes use of iCloud to sync information, on this case lists between units. So when the consumer opens the app for the primary time it must test if there’s information in iCloud. If there’s information in iCloud it should not create an inventory in Core Knowledge. But when there is not then must create one.

@FetchRequest(sortDescriptors: [NSSortDescriptor(keyPath: ListEntity.name, ascending: true)],
animation: .default) 
var lists: FetchedResults<ListEntity>

I regarded as sensible and simply use a @FetchRequest on the finish of the init within the PersistenceController and use a rely on it. However it is a unhealthy thought. Sure it work to rely the objects, but additionally provides an error. Accessing StateObject's object with out being put in on a View. This may create a brand new occasion every time. Additionally if I take advantage of the code beneath it does solely work when there isn’t a iCloud information and on gadget, however does work when there’s information in iCloud. What leads to two lists. What should not be the case.

if lists.rely != 0 {
    prepopulateData()
} else {
     UserDefaults.normal.set(true, forKey: "DataPreloaded")
}

The query is resolve this in a method that it really works and is clear code?

Related Articles

Social Media Auto Publish Powered By : XYZScripts.com