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
  • 55,199
  • 118
  • 297
  • 429
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,757
  • 5
  • 31
  • 49
  • 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
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
  • 38,684
  • 22
  • 91
  • 128