Member-only story

Why Do We Call Super When Making iPhone Apps?

Is it that super?

Steven Curtis
2 min readMay 19, 2021

I’ve just set up a new project. I’ve made it work by selecting the template.

The first thing that appears?

There is a UIViewController with the following code.

What is that super.viewDidLoad() doing there?

The Rule

This is about overriding and inheritance. viewDidLoad is called after the view is loaded into memory and the outlets are set.

Since we override viewDidLoad, we should call super. The reason for this is the UIViewController is not in our control and there could be some setup performed there, and this is really important.

The Rule Doesn’t Matter

It seems that in the UIViewController the function viewDidLoad does nothing.

super.viewDidLoad does nothing in this case.

--

--

Responses (1)