I have created TableViewController
by xib not on storyboard. I have view controller which loads by default. Now I want that TableViewController
as root controller. Thanks in advance.
Asked
Active
Viewed 71 times
0

pacification
- 5,838
- 4
- 29
- 51

blackstorm
- 60
- 10
-
possible duplicate of [Programmatically change rootViewController of storyBoard](https://stackoverflow.com/questions/22653993/programmatically-change-rootviewcontroller-of-storyboard) – Pratik Prajapati Jul 20 '18 at 07:20
-
1load xib in appdelegate and assign the load xib uiviewcontroller to navigation rootview controller – Chirag Shah Jul 20 '18 at 07:22
-
here i am using xib . – blackstorm Jul 20 '18 at 07:22
2 Answers
1
1 first register you xib in particular viewController in which you want to load. by register.nibLod 2 then in AppDelegate in - didFinish method make your that particular viewController as rootviewcontroller.

Rahul Patil
- 9
- 4
0
You can do like this.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
let navigationController: UINavigationController = UINavigationController(rootViewController: YourViewController()) //where YourViewController is name of viewController which you want to use as rootViewController
self.window?.rootViewController = navigationController
self.window?.makeKeyAndVisible()
return true
}

Shahrukh
- 740
- 7
- 25