/Switch

An iOS switch control implemented in Swift with full Interface Builder support.

Primary LanguageSwiftMIT LicenseMIT

Switch

GitHub issues Documentation

GitHub release Platform License

Carthage

CocoaPods CocoaPods downloads

Description

An iOS switch control implemented in Swift with full Interface Builder support.

To run the demo project:

pod try RoundedSwitch

Switch

Switch

Usage

Either config the switch in the Interface Builder or programatically as follow:

let mySwitch = Switch()
mySwitch.leftText = "Windows"
mySwitch.rightText = "Mac"
mySwitch.rightSelected = true
mySwitch.tintColor = UIColor.purpleColor()
mySwitch.disabledColor = mySwitch.tintColor.colorWithAlphaComponent(0.2)
mySwitch.sizeToFit()
mySwitch.addTarget(self, action: #selector(ViewController.switchDidChangeValue(_:)), forControlEvents: .ValueChanged)

Installation

Add the line below to your Cartfile:

github "T-Pham/Switch"

Add the line below to your Podfile:

pod 'RoundedSwitch'

Manually

Add the file Switch.swift to your project. You are all set.

License

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