I am trying to understand what is the difference between these two concepts.
When I speak about a controller in main.storyboard, do I mean UiViewController or ViewController? are they the same or complementary?
I tried to find some information but got mixed results, I would like you to explain it to me
UIViewController
is a class in the UIKit framework. Thing that controls a UIView
(aka "view controllers") inherit from UIViewController
.
If you create a new iOS app project in Xcode, and choose to use UIKit as the UI framework, it will generate a class called ViewController
as part of the project template.
class ViewController: UIViewController {
...
}
This ViewController
is a view controller, so it inherits from UIViewController
. Note that ViewController
is just a random name for the view controller that Xcode chose, it could just as well be YourAppViewController
or even FooBarBaz
.
You can also find view controllers in the storyboard. Those are the yellow circles with a white square inside. If you have just created a new project, the only one there would be the ViewController
Xcode generated. You can see which view controller class a view controller in the storyboard corresponds to by selecting it and checking the "Class" field in the identity inspector:
That iPhone-looking part is the UIView
that it controls.