import UIKit class ViewController: UIViewController { var count = 0 var label:UILabel! func incrementCount(){ self.count++ self.label.text = "\(self.count)" } }
import UIKit class ViewController: UIViewController { @IBOutlet weak var colorView: UIView! @IBOutlet weak var redControl: UISwitch! @IBOutlet weak var greenControl: UISwitch! @IBOutlet weak var blueControl: UISwitch! override func viewDidLoad(){ super.viewDidLoad() } @IBAction func changeColorComponent(sender: AnyObject){ let r: CGFloat = self.redControl.on ? 1:0 let g: CGFloat = self.greenControl.on ? 1:0 let b: CGFloat = self.blueControl.on ? 1 : 0 colorView.backgroundColor = UIColor(red: r, green: g, blue: b, alpha:1) } }
@IBAction func experiment(){ let nextController = UIImagePickerController() self.presentViewController(nextController, animated: true, completion:nil) }