-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathViewController.swift
78 lines (62 loc) · 2.8 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//
// ViewController.swift
// RacletteExample
//
// Created by Roman Blum on 15.11.16.
// Copyright © 2016 RMNBLM. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
lazy var raclette: Raclette = {
return Raclette(tableView: self.tableView)
}()
override func viewDidLoad() {
super.viewDidLoad()
tableView.tableFooterView = UIView()
tableView.register(CustomCell.self, forCellReuseIdentifier: String(describing: CustomCell.self))
var firstSection = raclette.addSection()
firstSection.headerTitle = "First Section Header"
firstSection.footerTitle = "First Section Footer"
let row1 = Row()
row1.configuration = { cell in
cell.textLabel?.numberOfLines = 0
cell.textLabel?.text = "Pinterest cred put a bird on it, meggings blue bottle pop-up la croix pok pok narwhal drinking vinegar hammock man bun VHS tofu freegan. Typewriter marfa tacos, viral lomo narwhal lyft farm-to-table subway tile wolf cold-pressed fam whatever fingerstache. Squid pickled kombucha you probably haven't heard of them neutra. Brooklyn taxidermy cray, helvetica venmo vinyl pop-up green juice pug. Fingerstache aesthetic poke, succulents keytar hammock man braid quinoa narwhal kickstarter drinking vinegar activated charcoal occupy fam stumptown. Ramps tattooed meh fam, freegan gastropub keytar gochujang fanny pack seitan tumblr 3 wolf moon gentrify. Skateboard beard humblebrag woke, swag cornhole kitsch everyday carry sartorial dreamcatcher retro." // Hipster Ipsum
}
firstSection.addRow(row1)
firstSection.createRow { row in
row.height = 200
row.configuration = { cell in
cell.textLabel?.text = "Second Row in First Section with a static height of 200"
}
}
firstSection.createRow { row in
row.configuration = { cell in
cell.textLabel?.text = "Overrides the global isRowHighlightingEnabled setting. You can touch me. :)"
}
row.shouldHighlight = { cell, _ in
return true
}
row.didSelect = { cell, tableInfo in
cell.textLabel?.text = "Selected"
tableInfo.tableView.deselectRow(at: tableInfo.indexPath, animated: true)
}
}
var secondSection = raclette.createSection { section in
section.headerTitle = "Second Section Header"
section.createRow { (row: Row<CustomCell>) in
row.configuration = { cell in
cell.textLabel?.text = "Text Label 2"
}
}
}
secondSection.footerTitle = "Second Section Footer"
raclette.createRow { row in
row.configuration = { cell in
cell.textLabel?.numberOfLines = 0
cell.textLabel?.text = "This row will be automatically added to the the second section"
}
}
raclette.isRowHighlightingEnabled = false
}
}