Don't construct unnecessary view controllers in MainSplitViewController

This commit is contained in:
Shadowfacts 2020-11-15 19:04:46 -05:00
parent dfad8740eb
commit 67a029180e
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 5 additions and 1 deletions

View File

@ -53,7 +53,11 @@ class MainSplitViewController: UISplitViewController {
primaryBackgroundStyle = .sidebar
setViewController(EnhancedNavigationViewController(), for: .secondary)
select(item: .tab(.timelines))
// don't unnecesarily construct a content VC unless the we're in actually split mode
// when we change from compact -> split for the first time, the VC will be transferred anyways
if traitCollection.horizontalSizeClass != .compact {
select(item: .tab(.timelines))
}
tabBarViewController = MainTabBarViewController(mastodonController: mastodonController)
setViewController(tabBarViewController, for: .compact)