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/dc7aeb7338d0fa59b4ef76902c18d493 to your computer and use it in GitHub Desktop.
Save rajuashok/dc7aeb7338d0fa59b4ef76902c18d493 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