How to change the initial view controller on the master detail view controller in swift

How to change the initial view controller on the master detail view controller. All I want to do is have a button show the default master detail controller.

I have posted a short video completely explaining my problem. Thanks.

Your basic issue is that in the app delegate you are addressing the root view controller as a split view controller, but once you add a plain old view controller as the initial view that is not what it is!

Basically you should take that code relating to the split view controller from the app delegate and do that stuff in the prepareForSegue method of the controller you are adding as initial view controller. That is when you will be able to access the split view controller, because that is the view controller that you will be loading at that time - when you have hit the button you mention in the video.

Don’t forget to move the delegate method too, and to make your new view controller’s subclass advertise conformance to UISplitViewControllerDelegate - basically everything in app delegate relating to split view controller moves to your new view controller. App delegate is then basically empty.