2

I have a NSViewController (I'm using a storyboard) with one iboutlet connected to a NSOutlineView (yes, I have made absolutely shure that it really is connected), but when I try to reference it in awakeFromNib, the outlet is still nil although they should be guaranteed to be connected in awakeFromNib. Any ideas or solutions?

Melodius
  • 2,505
  • 3
  • 22
  • 37
  • how about using `viewDidLoad` instead? – bluedome Jan 18 '15 at 12:50
  • In viewDidLoad the outlet is set and I can reference it there. As the documentation for awakeFromNib states that all outlets are guaranteed to be set when awakeFromNib is called, this seem to be a swift bug. – Melodius Jan 18 '15 at 16:59

1 Answers1

3

The Apple documentation says that the lifecycle of a NSViewController starts with viewDidLoad, so you should do your stuff there. enter image description here

Marius Fanu
  • 6,589
  • 1
  • 17
  • 19