|
Hi there, Im currently creating an app for an index of sheet music and I wish to filter the songs via favourites. I have the code down and am using ObservableObject data store to change the bool but when I change the toggle button in a detail view the change does not carry over in the list. the list does not automatically change. I beleive its because I'm using ObservedObject rather that EnvironmentalObject. I Thought to use this you need to change SceneDelegate but I created the app in Xcode 12 and there is no SceneDelegate. The toggle changes the isFavourite but doesnt update the list. see code below:
|
|
From Apple's documentation:
In your case,
You can use
The |
|
Thankyou so much! I have read and am keeping the page bookmarked for future reference. Im learning everyday with swift development and having people like you that explain it so well and am patient with me as a noob lol. I entered a @StateObject in the main struct and then used the environment modifier.
|
SPONSORED Building and maintaining in-app subscription infrastructure is hard. Luckily there's a better way. With RevenueCat, you can implement subscriptions for your app in hours, not months, so you can get back to building your app.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.