import UIKit
class ViewController: UIViewController ,UITextFieldDelegate,UITextViewDelegate,UIActionSheet Delegate,UIAlertViewDelegate{
var uiswitch:UISwitch!;
override func viewDidLoad() {
super.viewDidLoad()
uiswitch = UISwitch()
uiswitch.frame = CGRectMake(10, 230, 200, 30)
uiswitch.on = true
uiswitch.addTarget(self, action: Selector("switchDidChange"), forControlEvents: UIControlEvents.ValueChanged)
self.view.addSubview(uiswitch)
}
func switchDidChange(){
print(uiswitch.on)
}
}