forked from SnapKit/SnapKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ListViewController.swift
46 lines (35 loc) · 1.44 KB
/
ListViewController.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// ViewController.swift
// Example-iOS
//
// Created by Spiros Gerokostas on 01/03/16.
// Copyright © 2016 SnapKit Team. All rights reserved.
//
import UIKit
import SnapKit
class ListViewController: UITableViewController {
let kCellIdentifier = "CellIdentifier"
let demos = ["Simple Layout", "Basic UIScrollView"]
override func viewDidLoad() {
super.viewDidLoad()
self.title = "SnapKit iOS Demos"
self.tableView?.register(UITableViewCell.self, forCellReuseIdentifier: kCellIdentifier)
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return demos.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: kCellIdentifier)! as UITableViewCell
cell.textLabel?.text = demos[indexPath.row]
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 0 {
let viewController = SimpleLayoutViewController()
navigationController?.pushViewController(viewController, animated: true)
} else if indexPath.row == 1 {
let viewController = ViewController()
navigationController?.pushViewController(viewController, animated: true)
}
}
}