iOS Build a Simple iPhone App with Swift View Controllers and Views Creating IBOutlets

Jericoe States
Jericoe States
3,262 Points

creating IBOutlet

I can't find the problem with my code?

ViewController.swift
class ViewController: UIViewController {

  override func viewDidLoad() {
      super.viewDidLoad()

      @IBOutlet weak var textLabel: UILabel!
      // Do any additional setup after loading the view, typically from a nib.
  }

  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
}

1 Answer

Christian Mangeng
Christian Mangeng
15,967 Points

Hi jericoe,

you need to place the outlet outside of the viewDidLoad method. You can place it just below the class definition line.