File tree 2 files changed +15
-15
lines changed
2 files changed +15
-15
lines changed Original file line number Diff line number Diff line change 6
6
<dependencies >
7
7
<deployment identifier =" iOS" />
8
8
<plugIn identifier =" com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version =" 11524" />
9
- <capability name =" Alignment constraints with different attributes" minToolsVersion =" 5.1" />
10
- <capability name =" Constraints to layout margins" minToolsVersion =" 6.0" />
11
9
<capability name =" documents saved in the Xcode 8 format" minToolsVersion =" 8.0" />
12
10
</dependencies >
13
11
<scenes >
42
40
<autoresizingMask key =" autoresizingMask" widthSizable =" YES" heightSizable =" YES" />
43
41
<subviews >
44
42
<tableView clipsSubviews =" YES" contentMode =" scaleToFill" alwaysBounceVertical =" YES" dataMode =" prototypes" style =" grouped" separatorStyle =" default" rowHeight =" 44" sectionHeaderHeight =" 18" sectionFooterHeight =" 18" translatesAutoresizingMaskIntoConstraints =" NO" id =" qxX-wD-rRB" >
45
- <rect key =" frame" x =" 0.0" y =" 56 " width =" 375" height =" 611 " />
43
+ <rect key =" frame" x =" 0.0" y =" 0.0 " width =" 375" height =" 667 " />
46
44
<color key =" backgroundColor" cocoaTouchSystemColor =" groupTableViewBackgroundColor" />
47
45
<prototypes >
48
46
<tableViewCell clipsSubviews =" YES" contentMode =" scaleToFill" selectionStyle =" default" indentationWidth =" 10" reuseIdentifier =" Cell" textLabel =" ijb-6x-RWc" style =" IBUITableViewCellStyleDefault" id =" v8l-Hj-YG1" >
72
70
<color key =" backgroundColor" red =" 1" green =" 1" blue =" 1" alpha =" 1" colorSpace =" custom" customColorSpace =" sRGB" />
73
71
<constraints >
74
72
<constraint firstItem =" qxX-wD-rRB" firstAttribute =" leading" secondItem =" ZAV-fX-81n" secondAttribute =" leading" id =" 1aU-PO-R9K" />
75
- <constraint firstItem =" qxX-wD-rRB" firstAttribute =" topMargin" secondItem =" JJ0-TM-QJn" secondAttribute =" bottom" id =" AWq-e1-SQZ" />
76
73
<constraint firstItem =" AIK-tK-GZH" firstAttribute =" top" secondItem =" qxX-wD-rRB" secondAttribute =" bottom" id =" F5G-hJ-0eb" />
74
+ <constraint firstItem =" qxX-wD-rRB" firstAttribute =" top" secondItem =" ZAV-fX-81n" secondAttribute =" top" id =" g6g-na-0Ni" />
77
75
<constraint firstAttribute =" trailing" secondItem =" qxX-wD-rRB" secondAttribute =" trailing" id =" up0-J9-hv1" />
78
76
</constraints >
79
77
</view >
Original file line number Diff line number Diff line change @@ -35,7 +35,13 @@ class ViewController: UIViewController {
35
35
return l
36
36
} ( )
37
37
38
- var ticker : TickCounter !
38
+ lazy var ticker : TickCounter = {
39
+ let ticker = TickCounter ( )
40
+ try ! self . realm. write {
41
+ self . realm. add ( ticker)
42
+ }
43
+ return ticker
44
+ } ( )
39
45
40
46
override func viewDidLoad( ) {
41
47
super. viewDidLoad ( )
@@ -73,14 +79,6 @@ class ViewController: UIViewController {
73
79
. bindTo ( Realm . rx. add ( ) )
74
80
. addDisposableTo ( bag)
75
81
76
- /*
77
- Create a ticker object
78
- */
79
- ticker = TickCounter ( )
80
- try ! realm. write {
81
- realm. add ( ticker)
82
- }
83
-
84
82
/*
85
83
Bind bar item to increasing the ticker
86
84
*/
@@ -96,9 +94,9 @@ class ViewController: UIViewController {
96
94
Observing a single object
97
95
*/
98
96
Observable . from ( ticker)
99
- . map ( { ( ticker) -> String in
97
+ . map { ( ticker) -> String in
100
98
return " \( ticker. ticks) ticks "
101
- } )
99
+ }
102
100
. bindTo ( footer. rx. text)
103
101
. addDisposableTo ( bag)
104
102
}
@@ -116,6 +114,10 @@ extension ViewController: UITableViewDataSource {
116
114
cell. textLabel? . text = formatter. string ( from: Date ( timeIntervalSinceReferenceDate: lap. time) )
117
115
return cell
118
116
}
117
+
118
+ func tableView( _ tableView: UITableView , titleForHeaderInSection section: Int ) -> String ? {
119
+ return " Delete objects by tapping them, add ticks to trigger a footer update "
120
+ }
119
121
}
120
122
121
123
extension ViewController : UITableViewDelegate {
You can’t perform that action at this time.
0 commit comments