Latest 0.3.1
Homepage https://github.com/younatics/Toggler
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit
Authors

Version
Carthage Compatible
License: MIT
Platform
Swift 3.0

Intoduction

💡 don’t further use isSelected to every button. use Toggler to simply control your buttons
demo
demo

Don’t do like these any more

    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
        }
    }

Use Toggler

func buttonClicked(_ sender: UIButton) {
    toggler.on(toggle: sender)
}

Requirements

Toggler is written in Swift 3. Compatible with iOS 8.0+

Installation

Cocoapods

Toggler is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'Toggler'

Carthage

github "younatics/Toggler"

Usage

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)

References

Please tell me or make pull request if you use this library in your application :)

Author

younatics 🇰🇷

License

Toggler is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Toggler",
    "version": "0.3.1",
    "summary": "Easiest way to select a button and off other buttons",
    "description": "Easiest usage of button, written in Swift 3. You can add buttons what you want to control.",
    "homepage": "https://github.com/younatics/Toggler",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Seungyoun Yi": "younatics@gmail.com"
    },
    "source": {
        "git": "https://github.com/younatics/Toggler.git",
        "tag": "0.3.1"
    },
    "source_files": "Toggler/*.swift",
    "platforms": {
        "ios": "8.0"
    },
    "frameworks": "UIKit",
    "requires_arc": true,
    "pushed_with_swift_version": "3.1"
}

Pin It on Pinterest

Share This