Skip to content

Instantly share code, notes, and snippets.

@rajuashok
Last active January 17, 2020 02:47
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/a81ef332d8df8cc2e973be9e48b58766 to your computer and use it in GitHub Desktop.
Save rajuashok/a81ef332d8df8cc2e973be9e48b58766 to your computer and use it in GitHub Desktop.
View using DefaultRadioButton
class MyView: UIView, RadioButtonDelegate {
let radioButton = DefaultRadioButton()
override init(frame: CGRect) {
super.init(frame: frame)
radioButton.delegate = self
}
.
.
.
func onClick(_ sender: UIView) {
guard let sender = sender as? DefaultRadioButton else {
return
}
radioButton.isChecked = !radioButton.isChecked
// Take note of which radioButtons are selected if you need here.
// Possibly unselect the other radio buttons if this is a single choice question for e.g.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment