Tusker/Tusker/Screens/FindInstanceViewController....

53 lines
1.5 KiB
Swift

//
// FindInstanceViewController.swift
// Tusker
//
// Created by Shadowfacts on 12/19/19.
// Copyright © 2019 Shadowfacts. All rights reserved.
//
import UIKit
class FindInstanceViewController: InstanceSelectorTableViewController {
weak var parentMastodonController: MastodonController?
var instanceTimelineDelegate: InstanceTimelineViewControllerDelegate?
init(parentMastodonController: MastodonController) {
self.parentMastodonController = parentMastodonController
super.init()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
delegate = self
searchController.hidesNavigationBarDuringPresentation = false
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(cancelButtonPressed))
}
// MARK: - Interaction
@objc func cancelButtonPressed() {
dismiss(animated: true)
}
}
extension FindInstanceViewController: InstanceSelectorTableViewControllerDelegate {
func didSelectInstance(url: URL) {
let instanceTimelineController = InstanceTimelineViewController(for: url, parentMastodonController: parentMastodonController!)
instanceTimelineController.delegate = instanceTimelineDelegate
instanceTimelineController.browsingEnabled = false
show(instanceTimelineController, sender: self)
}
}