forked from rechsteiner/Parchment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewController.swift
27 lines (22 loc) · 1.04 KB
/
ViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import UIKit
import Parchment
// This is the simplest use case of using Parchment. We just create a
// bunch of view controllers, and pass them into our paging view
// controller. FixedPagingViewController is a subclass of
// PagingViewController that makes it much easier to get started with
// Parchment when you only have a fixed array of view controllers. It
// will create a data source for us and set up the paging items to
// display the view controllers title.
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let viewControllers = (0...10).map { IndexViewController(index: $0) }
let pagingViewController = FixedPagingViewController(viewControllers: viewControllers)
// Make sure you add the PagingViewController as a child view
// controller and constrain it to the edges of the view.
addChild(pagingViewController)
view.addSubview(pagingViewController.view)
view.constrainToEdges(pagingViewController.view)
pagingViewController.didMove(toParent: self)
}
}