Avatar of Peter Sigurdson
Peter SigurdsonFlag for Canada

asked on 

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

https://www.screencast.com/t/X7BJmQhFotlb

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?

Requirement:
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 fieldUser generated image
iOSProgrammingSwift Programming

Avatar of undefined
Last Comment
Adrian Sluijters
ASKER CERTIFIED SOLUTION
Avatar of Adrian Sluijters
Adrian Sluijters
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Programming
Programming

Programming includes both the specifics of the language you’re using, like Visual Basic, .NET, Java and others, but also the best practices in user experience and interfaces and the management of projects, version control and development. Other programming topics are related to web and cloud development and system and hardware programming.

55K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo