Skip to content

Commit 35eb1f7

Browse files
committed
storyboard and demo code clean up
1 parent 58432d9 commit 35eb1f7

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

Example/RxRealm/Base.lproj/Main.storyboard

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
<dependencies>
77
<deployment identifier="iOS"/>
88
<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"/>
119
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
1210
</dependencies>
1311
<scenes>
@@ -42,7 +40,7 @@
4240
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
4341
<subviews>
4442
<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"/>
4644
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
4745
<prototypes>
4846
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" textLabel="ijb-6x-RWc" style="IBUITableViewCellStyleDefault" id="v8l-Hj-YG1">
@@ -72,8 +70,8 @@
7270
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
7371
<constraints>
7472
<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"/>
7673
<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"/>
7775
<constraint firstAttribute="trailing" secondItem="qxX-wD-rRB" secondAttribute="trailing" id="up0-J9-hv1"/>
7876
</constraints>
7977
</view>

Example/RxRealm/ViewController.swift

+13-11
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ class ViewController: UIViewController {
3535
return l
3636
}()
3737

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+
}()
3945

4046
override func viewDidLoad() {
4147
super.viewDidLoad()
@@ -73,14 +79,6 @@ class ViewController: UIViewController {
7379
.bindTo(Realm.rx.add())
7480
.addDisposableTo(bag)
7581

76-
/*
77-
Create a ticker object
78-
*/
79-
ticker = TickCounter()
80-
try! realm.write {
81-
realm.add(ticker)
82-
}
83-
8482
/*
8583
Bind bar item to increasing the ticker
8684
*/
@@ -96,9 +94,9 @@ class ViewController: UIViewController {
9694
Observing a single object
9795
*/
9896
Observable.from(ticker)
99-
.map({ (ticker) -> String in
97+
.map{ (ticker) -> String in
10098
return "\(ticker.ticks) ticks"
101-
})
99+
}
102100
.bindTo(footer.rx.text)
103101
.addDisposableTo(bag)
104102
}
@@ -116,6 +114,10 @@ extension ViewController: UITableViewDataSource {
116114
cell.textLabel?.text = formatter.string(from: Date(timeIntervalSinceReferenceDate: lap.time))
117115
return cell
118116
}
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+
}
119121
}
120122

121123
extension ViewController: UITableViewDelegate {

0 commit comments

Comments
 (0)