Using PageViewController

class HomeViewController: UIViewController { private var pageViewController: UIPageViewController! private lazy var viewControllers: [UIViewController] = { var viewControllers = [UIViewController]() let storyboard = UIStoryboard(name: "Main", bundle: nil) let firstIntroViewController = storyboard.instantiateViewControllerWithIdentifier("intro1") let secondIntroViewController = storyboard.instantiateViewControllerWithIdentifier("intro2") viewControllers.append(firstIntroViewController) viewControllers.append(secondIntroViewController) return viewControllers }() override func viewDidLoad() { super.viewDidLoad() } override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if let vc = segue.destinationViewController as? UIPageViewController { pageViewController = vc pageViewController.dataSource = self pageViewController.delegate = self pageViewController.setViewControllers([viewControllers[0]], direction: .Forward, animated: true, completion: nil) } } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.