SplitviewController not as rootViewController

Hello,

We all well know about the SplitviewController. Apple highly recommends it to use as a root view controller whenever we use it.

But for me, I have to use SplitViewController in a Framework where my SDK user apps may or may not support the Splitview. So, for common my SDK needs to support splitview even the Apps doesn't.

So here comes the ???

how to present SplitViewController rather than having it as RootViewController

Presenting modely is an option but still not fully aware of its pros and difficulties

What will be the correct way, does anyone tried it?

Even if you don't recommend this kindly share your thoughts about its disadvantages, thanks in advance.

Have a nice day 🤗

Answered by robnotyou in 702282022

Apple say:
"...the split view controller is typically the root view controller of your app’s window."
typically... so it doesn't have to be.

Alternatively, can't you just set your rootViewController in code (based on some condition, where the app supports SplitViewController)?

if supportsSplitViewController {
	appDelegate?.window??.rootViewController = splitViewController
} else {
	// something else...
}
Accepted Answer

Apple say:
"...the split view controller is typically the root view controller of your app’s window."
typically... so it doesn't have to be.

Alternatively, can't you just set your rootViewController in code (based on some condition, where the app supports SplitViewController)?

if supportsSplitViewController {
	appDelegate?.window??.rootViewController = splitViewController
} else {
	// something else...
}

**Sorry guys Accidently Marked the ANSWER as Solved ** The problem is I am using this in an SDK, I can't have much complex operation for my user as going back from SDK may want more concentration in this approach. As I want all VC once in memory before I set SplitVC as rootViewController.

So kindly gave me any other approaches if possible

SplitviewController not as rootViewController
 
 
Q