Skip to content

Commit a39d74c

Browse files
committed
Merge branch 'release/0.7.0'
2 parents 5b1cafe + 5e703e9 commit a39d74c

35 files changed

+880
-311
lines changed

.codecov.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
coverage:
2-
ignore:
3-
- Carthage/*
4-
- Example/*
5-
- QuickTableViewControllerTests/*
6-
- Pods/*
72
status:
83
project:
94
default:

.jazzy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ github_url: https://github.com/bcylin/QuickTableViewController
55
github_file_prefix: https://github.com/bcylin/QuickTableViewController/blob/develop
66
xcodebuild_arguments: [-project, QuickTableViewController.xcodeproj, -scheme, QuickTableViewController-iOS]
77
module: QuickTableViewController
8-
module_version: 0.6.2
8+
module_version: 0.7.0
99
output: docs/output
1010
theme: fullwidth

.slather.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ output_directory: test_output/xml_report
77
ignore:
88
- Carthage/*
99
- Example/*
10+
- ExampleUITests/*
1011
- QuickTableViewControllerTests/*
1112
- Pods/*

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ cache:
88
- cocoapods
99
before_install:
1010
- export LANG=en_US.UTF-8
11+
- xcrun instruments -s devices
12+
- xcrun instruments -w "iPhone 7 (10.3.1) [" || true
1113
install:
1214
- bundle install --without development --deployment --jobs=3 --retry=3
1315
- bundle exec pod install
@@ -19,8 +21,8 @@ script:
1921
- make -B carthage
2022
- make -B docs
2123
after_success:
22-
- bash <(curl -s https://codecov.io/bash)
23-
- make coverage
24+
- bundle exec slather
25+
- bash <(curl -s https://codecov.io/bash) -f test_output/xml_report/cobertura.xml -X coveragepy -X gcov -X xcode
2426
- sh scripts/update-docs.sh
2527
notifications:
2628
email: false

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Change Log
22

3+
## v0.7.0
4+
5+
#### Breaking
6+
7+
* Remove the accessory view from the `AccessoryEnabled` protocol
8+
* Merge `IconEnabled` and `AccessoryEnabled` properties into the `RowStyle` protocol
9+
10+
#### Enhancements
11+
12+
* Add `OptionRow` and `RadioSection` to support mutually exclusive options
13+
14+
#### Fixes
15+
16+
* Use both cell type and cell style as the reuse identifiers for navigation rows to distinguish customized cell classes
17+
318
## v0.6.2
419

520
#### Enhancements

Example/Info.plist

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<dict>
55
<key>CFBundleDevelopmentRegion</key>
66
<string>en</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>QuickTableViewControllerExample</string>
79
<key>CFBundleExecutable</key>
810
<string>$(EXECUTABLE_NAME)</string>
911
<key>CFBundleIdentifier</key>
@@ -15,7 +17,7 @@
1517
<key>CFBundlePackageType</key>
1618
<string>APPL</string>
1719
<key>CFBundleShortVersionString</key>
18-
<string>0.6.2</string>
20+
<string>0.7.0</string>
1921
<key>CFBundleVersion</key>
2022
<string>101</string>
2123
<key>LSRequiresIPhoneOS</key>

Example/OptionRow.swift

Lines changed: 0 additions & 72 deletions
This file was deleted.

Example/ViewController.swift

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,17 @@ import Weakify
3030

3131
internal final class ViewController: QuickTableViewController {
3232

33+
private final class CustomCell: UITableViewCell {}
34+
3335
// MARK: - Properties
3436

35-
let debuggingSection = Section(title: nil, rows: [])
37+
private lazy var options: Section = RadioSection(title: "Radio Buttons", options: [
38+
OptionRow(title: "Option 1", isSelected: true, action: weakify(self, type(of: self).didToggleSelection)),
39+
OptionRow(title: "Option 2", isSelected: false, action: weakify(self, type(of: self).didToggleSelection)),
40+
OptionRow(title: "Option 3", isSelected: false, action: weakify(self, type(of: self).didToggleSelection))
41+
], footer: "See RadioSection for more details.")
42+
43+
private let debugging = Section(title: nil, rows: [])
3644

3745
// MARK: - UIViewController
3846

@@ -62,52 +70,35 @@ internal final class ViewController: QuickTableViewController {
6270
], footer: "UITableViewCellStyle.Value2 hides the image view."),
6371

6472
Section(title: nil, rows: [
65-
NavigationRow(title: "Empty section title", subtitle: .none)
73+
NavigationRow<CustomCell>(title: "Empty section title", subtitle: .none, customization: { cell, row in
74+
cell.accessoryView = UIImageView(image: #imageLiteral(resourceName: "iconmonstr-x-mark"))
75+
print(row.cellReuseIdentifier)
76+
})
6677
]),
6778

68-
Section(title: "Customized", rows: [
69-
OptionRow(title: "Option 1", isSelected: true, action: weakify(self, type(of: self).didToggleSelection)),
70-
OptionRow(title: "Option 2", action: weakify(self, type(of: self).didToggleSelection)),
71-
OptionRow(title: "Option 3", action: weakify(self, type(of: self).didToggleSelection))
72-
], footer: "See OptionRow for more details."),
73-
74-
debuggingSection
79+
options,
80+
debugging
7581
]
7682
}
7783

7884
// MARK: - UITableViewDataSource
7985

8086
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
8187
let cell = super.tableView(tableView, cellForRowAt: indexPath)
82-
let row = tableContents[indexPath.section].rows[indexPath.row]
83-
if row.title == "Empty section title" {
84-
// Alter the cells created by QuickTableViewController
85-
cell.imageView?.image = #imageLiteral(resourceName: "iconmonstr-x-mark")
86-
}
88+
// Alter the cells created by QuickTableViewController
8789
return cell
8890
}
8991

90-
// MARK: - UITableViewDelegate
91-
92-
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
93-
if let row = tableContents[indexPath.section].rows[indexPath.row] as? OptionRow {
94-
row.isSelected = !row.isSelected
95-
row.action?(row)
96-
tableView.reloadRows(at: [indexPath], with: .automatic)
97-
tableView.deselectRow(at: indexPath, animated: true)
98-
} else {
99-
super.tableView(tableView, didSelectRowAt: indexPath)
100-
}
101-
}
102-
10392
// MARK: - Private Methods
10493

10594
private func didToggleSelection(_ sender: Row) {
106-
if let row = sender as? OptionRow {
107-
let state = "\(row.title) is toggled = \(row.isSelected)"
108-
print(state)
109-
showDebuggingText(state)
95+
guard let option = sender as? OptionRow else {
96+
return
11097
}
98+
99+
let state = "\(option.title) is " + (option.isSelected ? "selected" : "deselected")
100+
print(state)
101+
showDebuggingText(state)
111102
}
112103

113104
private func didToggleSwitch(_ sender: Row) {
@@ -136,8 +127,9 @@ internal final class ViewController: QuickTableViewController {
136127
}
137128

138129
private func showDebuggingText(_ text: String) {
139-
debuggingSection.footer = text
140-
tableView.reloadSections([tableContents.count - 1], with: .automatic)
130+
debugging.footer = text
131+
let indexSet: IndexSet? = tableContents.index(where: { $0 === debugging }).map { [$0] }
132+
tableView.reloadSections(indexSet ?? [], with: .fade)
141133
}
142134

143135
}

ExampleUITests/ExampleUITests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ internal final class ExampleUITests: XCTestCase {
6060
XCTAssert(tablesQuery.staticTexts["CellStyle.value1 is selected"].exists)
6161

6262
tablesQuery.staticTexts["Option 1"].tap()
63-
XCTAssert(tablesQuery.staticTexts["Option 1 is toggled = false"].exists)
63+
XCTAssert(tablesQuery.staticTexts["Option 1 is deselected"].exists)
6464
tablesQuery.staticTexts["Option 2"].tap()
65-
XCTAssert(tablesQuery.staticTexts["Option 2 is toggled = true"].exists)
65+
XCTAssert(tablesQuery.staticTexts["Option 2 is selected"].exists)
6666
tablesQuery.staticTexts["Option 3"].tap()
67-
XCTAssert(tablesQuery.staticTexts["Option 3 is toggled = true"].exists)
67+
XCTAssert(tablesQuery.staticTexts["Option 3 is selected"].exists)
6868
}
6969

7070
}

ExampleUITests/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.6.2</string>
18+
<string>0.7.0</string>
1919
<key>CFBundleVersion</key>
2020
<string>1</string>
2121
</dict>

0 commit comments

Comments
 (0)