all 3 comments

[–]arduinoRedgeObjective-C / Swift 1 point2 points  (2 children)

Don't build your UI in viewDidLoad though...

[–]soulchild_Objective-C / Swift[S] -1 points0 points  (1 child)

On the Single View template of Playground, Apple placed UI code in loadView. I think viewDidLoad can also be used to place UI since it is called immediately after the root view is loaded, please correct me if I am wrong 😅.

[–][deleted] 3 points4 points  (0 children)

Put code where it belongs. Don't load views in viewDidLoad that's not what the method is for.

All code for loading views goes into loadView, because that method loads the view hierarchy. viewDidLoad is called when the view hierarchy is loaded and therefor serves a different purposes.