Dakata Dakata - 1 month ago 10
Swift Question

How to give a Class name to an initial Tab Bar Controller?

I am developing a swift application, which uses a Walkthrough screen as initial view controller when the app is launched for its first time.
I have a skip button there, which should dismiss it when the user clicks on it. The Problem occurs with the action of the button, where I have a code and inside the code I have to assign a name for the first TabBarViewController (the main screen in the app). Please look at the picture:
enter image description here

Would you please help me how to give a Class Name to this initial TabBar Controller,I successfully created a Storyboard ID in my case(InitialViewController), but I can't give a class name, look at the picture:
enter image description here
I have never done this before, I tried to create a new CocoaTouch file and assign a name TabBar Controller, but when I go to the Main StoryBoard and try to type the name inside, it is not recognised. Any ideas how to assign a class name to it ?

Answer

It looks like your TabBarController is a regular UITabBarController In that case your code should look like this:

let nextView = self.storyboard?.instantiateViewController(withIdentifier: "InitialViewController") as! UITabBarController
// force unwrapping for brevity