Created
January 14, 2020 16:54
-
-
Save rajuashok/dc7aeb7338d0fa59b4ef76902c18d493 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