Skip to content
/ Switch Public

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

License

Notifications You must be signed in to change notification settings

T-Pham/Switch

Repository files navigation

'   :::===  :::  ===  === ::: :::==== :::===== :::  ===
'   :::     :::  ===  === ::: :::==== :::      :::  ===
'    =====  ===  ===  === ===   ===   ===      ========
'       ===  ===========  ===   ===   ===      ===  ===
'   ======    ==== ====   ===   ===    ======= ===  ===
'                                                              

Switch

CI Status GitHub issues Codecov 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:

import Switch
...
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)

Please note that the module name is Switch. However, when installed with CocoaPods, it is RoundedSwitch.

Please see the Reference Documentation for details.

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.