-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathDecisionViewController.swift
29 lines (24 loc) · 1.12 KB
/
DecisionViewController.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
import UIKit
class DecisionViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func viewWillAppear(_ animated: Bool) {
setAuthentication()
}
func setAuthentication() {
if UserDefaults.exists(key: Constants.UserDefaultsKey.acessToken) {
let profileStoryboard = UIStoryboard(name: "Profile", bundle: Bundle.main)
let profileVC = profileStoryboard.instantiateViewController(withIdentifier: "ProfileViewController")
self.navigationController?.pushViewController(profileVC, animated: false)
} else {
let profileStoryboard = UIStoryboard(name: "Profile", bundle: Bundle.main)
guard let vc: UITabBarController = profileStoryboard.instantiateViewController(withIdentifier: "AuthTabBarController") as? UITabBarController else {
fatalError("Cannot Cast to UITabBarController")
}
vc.selectedIndex = 0
self.navigationController?.pushViewController(vc, animated: false)
}
}
}