DEV

Xcode Swift - 画面遷移

下記で移動できる。

let nextViewController: UIViewController = SecondViewController()
self.presentViewController(nextViewController, animated: true, completion: nil)

上記で移動した場合、下記で戻れる。navigation barのview間の遷移には使えないっぽい。

self.dismissViewControllerAnimated(true, completion: nil)

2画面戻る場合は、下記でいいらしい。

self.presentingViewController?.presentingViewController?.dismissViewControllerAnimated(true, completion: nil)

参考: Swift - 画面遷移