|
This is, in part, a follow-up to my question last week. I have an enum of options for filtering in my library management app:
All but the last two options are fairly straightforward text-filtering for which I adapted this HWS+ tutorial. The last two require picker views, however. But I'm running into a strange problem when I attempt to work those picker views into a view that encompasses all the optios: This works as intended:
This, however, does not:
Which... doesn't make sense to me. The only difference between the two (at least so far as the picker portion is concerned) is that instead of:
I'm using:
I can get around it by bypassing
But I'd much rather understand WHY it isn't working, rather than just getting around it with guesswork. |
|
Hey, it's me again 😂 TLDRThe only thing you're missing is an
block on your DisclaimerI don't have all the code back code you have, so I had to simplify it quite a bit, but it should work nonetheless. Here's the view I am using:
Notable changes I made:
None of those changes should break the answer. Now the actual answerThe first step I take when debugging something like this is to check whether your
When you run it you see your rating variable is changing as expected, so the issue isn't with the picker but with the list showing the filtered information. Which brings me to the issue you have: you're never updating your
Full view:
|
|
|
|
Thank you again, @jakcharvat. I very much appreciate you taking the time to help me with this. I actually did discover Thank you again. |
|
Thanks so much for the compliment Paul, really means a lot to me. @NCrusher74, happy to help, please let me know if it worked, if not I'd love to dig in a bit deeper and try to debug it with you :) |
SPONSORED Alex is the iOS & Mac developer’s ultimate AI assistant. It integrates with Xcode, offering a best-in-class Swift coding agent. Generate modern SwiftUI from images. Fast-apply suggestions from Claude 3.5 Sonnet, o3-mini, and DeepSeek R1. Autofix Swift 6 errors and warnings. And so much more. Start your 7-day free trial today!
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.