Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rajuashok
Created January 14, 2020 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajuashok/d892fe4002b70e17ac3aef5d7c33dc3e to your computer and use it in GitHub Desktop.
Save rajuashok/d892fe4002b70e17ac3aef5d7c33dc3e to your computer and use it in GitHub Desktop.
OnClick example for single choice RadioButton group
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