I created a working app using Master-Detail storyboard, then decided to move the search to a new page before the table view page.
(source: photoandgem.com)
Part of the problem is one of structure:
Should I have a new navigation controller that embeds the search view controller?
Or should the search view controller be embedded in the original (table view) navigation controller?
Or some other structure?
As is, I set the search view controller as the initial view controller, but the code is incorrect in AppDelegate.swift so I get an error
"Could not cast value of type 'searcher.searchViewController' (0x10bd12dc8) to 'UISplitViewController'."
I know it should have the search view controller incorporated, but I don't know how to fix that.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let splitViewController = self.window!.rootViewController as! UISplitViewController
let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController
navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem
splitViewController.delegate = self
return true
}
I read all the Apple documentation, and several tutorials, and countless questions/answers on stackoverflow, and I have no problem with the Master-Detail structure without the new search view controller, but I don't understand enough to proceed.