troubleshooting Question

Toggling a Switch's state from a Button in IOS Swift

Avatar of Peter Sigurdson
Peter SigurdsonFlag for Canada asked on
ProgrammingiOSSwift Programming
1 Comment1 Solution73 ViewsLast Modified:

In IOS Swift programming, if I have a SWITCH, I can make it Action or Outlet.

If I make the SWITCH an ACTION, I cannot set its STATE from another button because there is no VALUE parameter to get a handle on and set.

If I make a SWITCH an OUTLET, I can SET the Switch State from another point, but I cannot take action based on setting that switch because an OUTLET does not have an action func

How can I get around this situation?

1. Click the BUTTON: Update the text property of a field AND change the STATE of the button
2. Click the BUTTON:  Update the text property of a fieldswitches-and-buttons.png
Adrian Sluijters
Developer, Administator and Railway Track Engineer (yep you read that right)

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros