Xcode Не срабатывает одна из функций перехода на новый storyboard
Первый Экшн @IBAction func logOutButton срабатывает и переходит на нужный view controller. А @IBAction func startButton просто игнорируется при выполнении. ("go to 1" принтуется и условие точно срабатывает)
class MainViewController: UIViewController {
var window: UIWindow?
@IBOutlet weak var selectedSegment: UISegmentedControl!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func logOutButton(_ sender: Any) { // тут все работает
do {
try Auth.auth().signOut()
} catch {
print("Error")
}
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let firstViewController = storyBoard.instantiateViewController(withIdentifier: "AuthViewController") as! AuthViewController
firstViewController.modalTransitionStyle = .crossDissolve // это значение можно менять для разных видов анимации появления
firstViewController.modalPresentationStyle = .overCurrentContext // это та самая волшебная
present(firstViewController, animated: true, completion: nil)
}
@IBAction func startButton(_ sender: Any) { // вот эта кнопка не срабаоывает...
if selectedSegment.selectedSegmentIndex == 1 {
print("go to 1")
let newStoryBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let newViewController = newStoryBoard.instantiateViewController(withIdentifier: "BeforeTabBarController") as! BeforeTabBarController
self.presentingViewController?.present(newViewController, animated: true, completion: nil)