Skip to content

Latest commit

 

History

History
34 lines (31 loc) · 1.06 KB

README.md

File metadata and controls

34 lines (31 loc) · 1.06 KB

YeraSlideSwitch

An iOS Smart slide switch

How to use

Just add the following code where you need to use it

let slideSwitch = YeraSlideSwitch.init(frame: CGRect.init(x: 100, y: 200, width: UIScreen.main.bounds.size.width - 200, height: (UIScreen.main.bounds.size.width - 200)*2))
slideSwitch.backgroundColor = UIColor.clear
self.view.addSubview(slideSwitch)
slideSwitch.setOnWithAnimate()

How to get the status of the switch

slideSwitch.isOn()

How to turn on/off switch without animation

slideSwitch.setOn()
slideSwitch.setOff()

How to turn on/off switch with animation

slideSwitch.setOnWithAnimate()
slideSwitch.setOffWithAnimate()

Requirements

iOS8.0 and above

About the use of the control background

The switch in the homekit is large, up and down, moving elegantly and accurately judged. It is very suitable for a single switch with only one single page. It is impressive.

If you have any questions, please let me know

email:erlanov14@gmail.com