Skip to content

Commit 62d09c1

Browse files
committed
more neatening (not so minor: using addChild manually this way was wrong)
1 parent 2cd52df commit 62d09c1

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

bk2ch09p488basicMasterDetail/MasterDetail/AppDelegate.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ class AppDelegate : UIResponder, UIApplicationDelegate {
1414
let master = MasterViewController()
1515
master.title = "Pep"
1616
let nav1 = UINavigationController(rootViewController:master)
17-
svc.addChildViewController(nav1)
1817
let detail = DetailViewController()
1918
let nav2 = UINavigationController(rootViewController:detail)
20-
svc.addChildViewController(nav2)
19+
svc.viewControllers = [nav1, nav2]
2120
self.window!.rootViewController = svc
2221
let b = svc.displayModeButtonItem()
2322
detail.navigationItem.leftBarButtonItem = b

bk2ch09p490universalSplitViewControllerManual/SplitViewControllerManual/ViewController.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ class ViewController: UIViewController {
1515
override func viewDidLoad() {
1616
super.viewDidLoad()
1717
let svc = UISplitViewController()
18-
svc.addChildViewController(PrimaryViewController())
19-
svc.addChildViewController(SecondaryViewController())
18+
svc.viewControllers = [PrimaryViewController(), SecondaryViewController()]
2019
self.addChildViewController(svc)
2120
self.view.addSubview(svc.view)
2221
svc.didMoveToParentViewController(self)

0 commit comments

Comments
 (0)