diff --git a/iOS/MasterTimeline/MasterTimelineViewController.swift b/iOS/MasterTimeline/MasterTimelineViewController.swift index b9c1c906f..a77f41f90 100644 --- a/iOS/MasterTimeline/MasterTimelineViewController.swift +++ b/iOS/MasterTimeline/MasterTimelineViewController.swift @@ -47,6 +47,19 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange), name: UIContentSizeCategory.didChangeNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange), name: .DisplayNameDidChange, object: nil) + // Setup the Search Controller + searchController.delegate = self + searchController.searchResultsUpdater = self + searchController.obscuresBackgroundDuringPresentation = false + searchController.searchBar.delegate = self + searchController.searchBar.placeholder = NSLocalizedString("Search Articles", comment: "Search Articles") + searchController.searchBar.scopeButtonTitles = [ + NSLocalizedString("Here", comment: "Here"), + NSLocalizedString("All Articles", comment: "All Articles") + ] + navigationItem.searchController = searchController + definesPresentationContext = true + // Configure the table tableView.dataSource = dataSource numberOfTextLines = AppDefaults.timelineNumberOfLines @@ -61,21 +74,6 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner super.viewWillAppear(animated) } - override func viewWillLayoutSubviews() { - // If you setup the Search Controller in viewWillLayoutSubviews it won't show by default on creation - searchController.delegate = self - searchController.searchResultsUpdater = self - searchController.obscuresBackgroundDuringPresentation = false - searchController.searchBar.delegate = self - searchController.searchBar.placeholder = NSLocalizedString("Search Articles", comment: "Search Articles") - searchController.searchBar.scopeButtonTitles = [ - NSLocalizedString("Here", comment: "Here"), - NSLocalizedString("All Articles", comment: "All Articles") - ] - navigationItem.searchController = searchController - definesPresentationContext = true - } - // MARK: Actions @IBAction func markAllAsRead(_ sender: Any) {