From 1bba1ffe1648cb1831ce9dcc937fa05589e52ea3 Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Wed, 7 Nov 2018 15:54:30 +0530 Subject: [PATCH] iPad: Configuring the split-view controller should happen in init(), not loadView() --- WireGuard/WireGuard/UI/iOS/MainViewController.swift | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/WireGuard/WireGuard/UI/iOS/MainViewController.swift b/WireGuard/WireGuard/UI/iOS/MainViewController.swift index 81e78a3..92bb864 100644 --- a/WireGuard/WireGuard/UI/iOS/MainViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/MainViewController.swift @@ -6,18 +6,23 @@ import UIKit class MainViewController: UISplitViewController { var tunnelsListVC: TunnelsListTableViewController? - override func loadView() { + init() { let detailVC = UIViewController() + detailVC.view.backgroundColor = UIColor.white let detailNC = UINavigationController(rootViewController: detailVC) let masterVC = TunnelsListTableViewController() let masterNC = UINavigationController(rootViewController: masterVC) + self.tunnelsListVC = masterVC + + super.init(nibName: nil, bundle: nil) + self.viewControllers = [ masterNC, detailNC ] + } - super.loadView() - - tunnelsListVC = masterVC + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") } override func viewDidLoad() {