Moving that code to -windowDidLoad
is usually a safe bet, it's called after the window is fully loaded compared to -awakeFromNib
where you can potentially run into problems because the order on which it's called on all the objects in your nib is not defined.
In general it's a good idea to make a mental note of all the initialization you're doing, what parts need a UI to work correctly, what parts can be delayed until the user performs an action, and so on. For example, it's good to delay tasks like doing a Core Data fetch until the last minute, in case you ever have a window that's not opened until the user requests it. On the other hand, sometimes you'll be working with an object like an outline view that needs its data source to be pre-populated for persistence methods to work.
Once you know what you're doing and in what order it needs to be done, you can choose some combination of init, awakeFromNib, yyyWillLoad, or xxxDidLoad and you'll take care of a lot of bugs like this before they have a chance to cause trouble.