TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Oct 2017 |
SwiftSwift Version | 4.0 |
SPMSupports SPM | ✓ |
Maintained by [younatics].
isSelected
to every button. use Toggler
to simply control your buttons
func buttonClicked(_ sender: UIButton) {
switch sender.tag {
case 0:
button1.isSelected = true
button2.isSelected = false
button3.isSelected = false
button4.isSelected = false
button5.isSelected = false
case 1:
button1.isSelected = false
button2.isSelected = true
button3.isSelected = false
button4.isSelected = false
button5.isSelected = false
case 2:
button1.isSelected = false
button2.isSelected = false
button3.isSelected = true
button4.isSelected = false
button5.isSelected = false
case 3:
button1.isSelected = false
button2.isSelected = false
button3.isSelected = false
button4.isSelected = true
button5.isSelected = false
case 4:
button1.isSelected = false
button2.isSelected = false
button3.isSelected = false
button4.isSelected = false
button5.isSelected = true
default:
break
}
}
Toggler
func buttonClicked(_ sender: UIButton) {
toggler.on(toggle: sender)
}
Toggler
is written in Swift 3. Compatible with iOS 8.0+
Init with UIButton
or UISwtich
and default index
toggler = Toggler(default: 0, togglers: [button1, button2, button3, button4, button5])
Toggle button
toggler.on(toggle: sender)
toggler.onAt(index: sender.tag)
Add more button
toggler.add(toggle: button6)
Remove button
toggler.remove(at: 5)
Toggler is available under the MIT license. See the LICENSE file for more info.