|
I’m using a custom button type that is disabled when pressed, amongst other things. I’m able to successfully disable the buttons, but even though the dynamic shouldBeDisabled property is set back to false at a later time, the buttons remained permanently disabled. Note: Via different outputs to the console, I’m able to confirm that shouldBeDisabled is indeed being changed to false, and the buttons are not redrawn.
Why would the button successfully become disabled, but not be enabled again when I set shouldBeDisabled back to false? |
|
|
|
I apologize if this code is ugly. I'm completely-blind and just finished 100 Days of SwiftUI about a month ago. /* I was trying to keep my code sample small to keep the post short I instantiate these buttons in a parent view, where I was originally initializing every button needed and storing them in an array. I was told in some Swift Facebook groups that storing an array of these buttons in the parent view is bad practice, so I’ve track these buttons by their data instead. I’ll include the actual code this time, so I apologize for the lengthier post. First, here’s the button type:
Now, here's the class that tracks hidden button data
And finally, here's the parent view where the buttons are instantiated, and where I attempt to enable some of the buttons again.
|
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!
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.