0

I've made an app for Apple Watch ("Brain Trainer For Apple Watch") that uses the following code:

pushControllerWithName("SumsInterfaceController", context: type)

I wanted to know if there's similar code to this for the iPhone version of Swift?

Marcus Leon
  • 53,069
  • 115
  • 287
  • 420
Sms8
  • 11
  • 4

2 Answers2

0

For Navigation Controller

navigationController?.pushViewController(viewController, animated: true)

For more info check this.

For Segue check this and this.

Community
  • 1
  • 1
Thellimist
  • 3,199
  • 4
  • 29
  • 47
  • When I try to use that (see code) it gives me an error saying: use of unsolved identifer 'pushViewController' func segue(type:String) { pushViewController(SumsViewController, animated: true) } – Sms8 Apr 30 '15 at 23:02
  • Thanks i'll check it out! – Sms8 Apr 30 '15 at 23:06
0

For UIViewController

self.presentViewController(viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)?)

self.performSegueWithIdentifier(identifier: String?, sender: AnyObject?)

For UINavigationController: UIViewController

self.pushViewController(viewController: UIViewController, animated: Bool)

Dismiss UIViewController

self.dismissViewControllerAnimated(flag: Bool, completion: (() -> Void)?)

Dismiss UINavigationController: UIViewController

self.popViewControllerAnimated(animated: Bool)
self.popToViewController(viewController: UIViewController, animated: Bool)
self.popToRootViewControllerAnimated(animated: Bool)
Arbitur
  • 37,971
  • 22
  • 89
  • 126