Created
January 14, 2020 16:54
-
-
Save bobbyflowstate/d892fe4002b70e17ac3aef5d7c33dc3e to your computer and use it in GitHub Desktop.
OnClick example for single choice RadioButton group
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func onClick(_ sender: UIView) { | |
guard let currentRadioButton = sender as? RadioButton else { | |
return | |
} | |
[ | |
radioButton1, | |
radioButton2 | |
].forEach { $0.isChecked = false } // Set all to unchecked first | |
currentRadioButton.isChecked = !currentRadioButton.isChecked | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment