-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBreedCoordinator.swift
33 lines (27 loc) · 1.07 KB
/
BreedCoordinator.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Created by Josh Adams, who holds the copyright and reserves all rights, on 9/24/22.
import UIKit
class BreedCoordinator: Coordinator, BrowseBreedsDelegate, BreedDelegate {
var navigationController: UINavigationController
private(set) var breedDetailVC: BreedDetailVC?
init(navigationController: UINavigationController) {
self.navigationController = navigationController
}
func start() {
let vc = BrowseBreedsVC(browseBreedsDelegate: self)
vc.tabBarItem = UITabBarItem(title: "Browse", image: Symbols.pawPrint, selectedImage: nil)
navigationController.pushViewController(vc, animated: false)
}
func showDetails(breed: Breed, animated: Bool) {
let breedDetailVC = BreedDetailVC(breed: breed, breedDelegate: self)
self.breedDetailVC = breedDetailVC
navigationController.pushViewController(breedDetailVC, animated: animated)
}
func showWebpage(url: URL, didSucceed: ((Bool) -> ())?) {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url)
didSucceed?(true)
} else {
didSucceed?(false)
}
}
}