Post

Replies

Boosts

Views

Activity

Reply to ForEach Breaks Data Binding
I'm having similar trouble, but unfortunately iterating on the indices and passing an array item with subscript won't work for me. My ForEach statement iterates on the struct's name field and simultaneously sorts the array:                     ForEach(store.cocktails.sorted {$0.cocktailName < $1.cocktailName }) { ******** in                         CocktailCell(********: $********)                     } I don't want to give up the automatic sort, hence, I cannot access the index each time through in order to send a single array item. I do, however, have to pass a binding for the item because at each level below I either want to read the values in the struct or write to them. The object "store" is instantiated with @StateObject at the parent level, and passed in as an ObservedObject at this view level. Any ideas?
Jul ’20
Reply to NSPersistentCloudKitContainer not syncing existing data
Any resolution to this issue? I decode a large data set from a JSON file upon first run of my iOS app. Two simulator devices running on the same iCloud account credentials both "upload" their data set to the cloud although the sets are in all ways identical. A restart of each app shows double entries. Subsequently added data items are synced but not duplicated. Items have a UUID id which is identical between devices. Puzzling how to deliver the app with the desired large data set intact without causing duplicate entries. Is the toggle-a-boolean work-around the only way?
Sep ’20
Reply to Core Data+CloudKit causing duplication after second device app install
Never mind...I read Consuming Relevant Store Changes in Apple docs and downloaded the sample project Synchronizing a Local Store to the Cloud from 2019. The needed deduplication code is explained and shown in the former and executed in the latter. Beware: there is a code error in the sample project. You want to register for remote change notifications fired by the container.persistentStoreCoordinator, not the container itself.
Oct ’20
Reply to NavigationSplitView not working as shown in "What's new with SwiftUI" session
I found that appending an .id modifier to the detail column resolved the problem for me:          } detail: {             if let selectedCocktail {                CocktailDetailView(pCocktail: selectedCocktail)                   .navigationTitle("(selectedCocktail.favorite ? "(profile.userData.favoriteCocktailsIcon.rawValue)" : "") (selectedCocktail.cocktailName ?? "")")                   .id(selectedCocktail.id) //workaround }
Jan ’23