|
At the moment I try to make the settings for my App. For that I use toggles that change the UserDefaults, but my problem is, that I cant figure out, how i can make the isOn parameter inside the Toggle variable. I created a "DataType" called "settingItem" which includes defirent properties like the name, the icon and the title of the UserDefaults key. The Toggles on the settings page are inside a List. That's why the isOn parameter should be represented by a variable.
|
|
This syntax doesn't look correct:
The This looks like you're telling SwiftUI the entire chained variable ( You need to let SwiftUI know which part is bound. Try:
|
|
First, thanks for your reply. Yes I only want to change the value of the UserDefault associated with that I tried
Do you have an idea how to solve this? |
|
Here's something I tried. Hope this leads you to your solution.
Teach the Duck how to CodeIf you're having a bit o'trouble with a concept. Tell the duck! If you comment your code, then tell the duck what you're attempting to do, you often rephrase your solution in simpler terms. Try the rubber duck method to peel back the uncertainty and try to focus on what may be the root of the problem. See -> Rubber Ducks 🐤 Teach Swift Keep Coding! |
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure and A/B test your entire paywall UI 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.