From 188bacee250daa2804b539ba6bfc9b655130fefd Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Thu, 27 Jun 2019 16:30:24 -0500 Subject: [PATCH] Move nav state ownership to MasterFeedViewController --- iOS/AppDelegate.swift | 9 --------- iOS/MasterFeed/MasterFeedViewController.swift | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/iOS/AppDelegate.swift b/iOS/AppDelegate.swift index e02bbe887..9fc4b4728 100644 --- a/iOS/AppDelegate.swift +++ b/iOS/AppDelegate.swift @@ -40,9 +40,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele var authorAvatarDownloader: AuthorAvatarDownloader! var feedIconDownloader: FeedIconDownloader! - var navState: NavigationStateController! - var masterFeedViewController: MasterFeedViewController! - var unreadCount = 0 { didSet { if unreadCount != oldValue { @@ -70,15 +67,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele registerBackgroundTasks() - navState = NavigationStateController() - // Set up the split view let splitViewController = window!.rootViewController as! UISplitViewController - let feedNavController = splitViewController.viewControllers[0] as! UINavigationController - masterFeedViewController = feedNavController.topViewController as? MasterFeedViewController - masterFeedViewController.navState = navState - let detailNavController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController detailNavController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem splitViewController.delegate = self diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 2b79af139..dd619e7bb 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -19,8 +19,8 @@ class MasterFeedViewController: ProgressTableViewController, UndoableCommandRunn @IBOutlet private weak var addNewItemButton: UIBarButtonItem! var undoableCommands = [UndoableCommand]() - var navState: NavigationStateController! + let navState = NavigationStateController() override var canBecomeFirstResponder: Bool { return true }