|
I want to show a list of users that are saved through swift data. I want the user to be able to sort the list in a few options that I will provide or search for a particular user tapping on any of the users leads the user to a detailed view screen with further information since I want to provide more options later I want to be able to pass the navigation path to the detailed view I created a list view to run inside the initialiser my predicate and also passed a navigation path binding pressing the navigation link to the detailed view freezes the app if I remove the path or the predicate it works, but not together, here is the least code that reproduces the error struct ContentView: View {
} struct ListView:View {
} struct DetailedView:View { let user:User
} @Model class User {
} |
|
I didn't really try to get into details, seems like it creates infinite loop with binding most probably as memory is used up and app basically freezes. One of the possible solutions create an observable object with nav path and inject into environment. So you'll be able to access it from the views which are actually need that object without passing down the subviews.
|
|
Yet another option to create path in the view where you already have filtered data like so:
|
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
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.