Some of the ios developers, including me, dont want to use storyboards. Failed to instantiate the default view controller for uimainstoryboardfile main. The root viewcontroller lies inside a storyboard, i have not written a single code in the appdelegate. Programatically set the initial view controller when using. This storyboard software provides all essential tools on its interface namely, drawing tools pencil, brush, etc. In the apps setting, go to your target and the info tab. Rootviewcontroller assigns the first viewcontroller what should be shown when your application starts, if you assign a viewcontroller as a windows. Now, when i launch the app in ios simulator nothing shows. Easily change the rootviewcontroller for the main uiwindow innovianhyperwindowswitch. Each view controller has a button that switches to the other view controller. Programmatically change rootviewcontroller of storyboard. Rootviewcontroller you wont have any navigtiontoolbar and the only way to show any other view will be calling presentviewcontroller. I started with an empty application and added the storyboard file myself, added a view controller to the storyboard and then embedded it into the navigation controller. On the general tab, clear the value for main interface.
Heres how to switch root view controllers in swift. Navigate to viewcontroller from appdelegate xamarin. Get unlimited access to the best stories on medium and support writers. We all may have different reasons but this is a need after all. Storyboard perhaps the designated entry point is not set. You can change the windows rootviewcontroller throughout the application life cycle. Though technically is allowed, in this case it is not a requirement. In this video, a new view controller that was created in storyboard that does not have its own. Swinjectstoryboard is an extension of swinject to automatically inject dependency to view controllers instantiated by a storyboard. Forceunwrap is totally reasonable here as long as you dont change the rootviewcontroller. When you change the rootviewcontroller, you still may want to add a uiimageview as a subview on the window to act as a splash image. How to switch root view controllers in swift ios dev diary.
1438 720 1045 919 1406 1029 534 1042 159 198 1147 638 1101 607 358 487 367 1299 938 392 862 844 916 185 1069 594 1366 1458 96 748 593 514 1066 1328 1241 997 700 1204 468 130 362 372 12 226 768 1139