iOS Development Notes


  1. Model-View-Controller is a design pattern in iOS.

  2. Unlike in Android Studio, the Interface Builder is not a graphical representation of code. A storyboard file is an archive of object instances.

  3. Outlets are references to objects: @IBOutlet var questionLabel: UILabel! (IB means interface builder.) (Right click the item and drag it to the assistant editor to create the outlet.)

  4. Actions: @IBAction func showNextQuestion(_ sender: UIButton) {} (Right click the item and drag it to the assistant editor to create the action.)

  5. Use View Controller to add new screens. Use Embed in > Navigation Controller to add a nav controller.

  6. Use this to pass info between screens:

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        segue.destination.navigationItem.title = textField.text
  7. Use performSegue to create a segue programmatically (could be used for conditional segue.)

    performSegue(withIdentifier: "Foo", sender: nil)
  8. Right click and drag to a view controller to add the new view controller to the Tab Bar Controller (select view controllers).

  9. Connect the new ViewController file by setting the custom class attribute in storyboard.

View Controller Lifecycle:

  1. /images/ios_lifecycle.png

  2. Detailed methods:

MVC Architecture

  1. /images/mvc.png

Project Organization

  1. Example: /images/ios_project_organization.jpeg