How to use UISwitch control in Swift

This is UISwitch example when you build iOS applications

Fist I am going to create sigleview application and add UILable, UISwitch into the ViewController as shown in the following image

Next you can connect UISwitch and UILable with ViewController.swift with IBAction and IBOutlet

 

You have the switchValueChanged() function to get the status of the UISwitch control. When the value of the switch is changed this function will be called

Leave a Reply

Your email address will not be published. Required fields are marked *