Skip to content

Commit 3b644a2

Browse files
committed
Merge branch 'feature/detail-text' into develop
Close #30
2 parents 69dd55e + 98c19cc commit 3b644a2

29 files changed

Lines changed: 683 additions & 413 deletions

CHANGELOG.md

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

3+
## v1.1.0
4+
5+
#### Enhancements
6+
7+
* Rename `Row`'s title and subtitle to text and detail text to align with `UITableViewCell`'s naming
8+
* `Subtitle` is deprecated and will be removed in **v2.0.0**
9+
* Enable **detailText** in `OptionRow` and `SwitchRow`
10+
311
## v1.0.0
412

513
#### Enhancements

Example-iOS/ViewControllers/AppearanceViewController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@ internal final class AppearanceViewController: QuickTableViewController {
4141

4242
tableContents = [
4343
Section(title: "Switch", rows: [
44-
SwitchRow(title: "SwitchCell", switchValue: true, action: { _ in })
44+
SwitchRow(text: "SwitchCell", switchValue: true, action: { _ in })
4545
]),
4646

4747
Section(title: "Tap Action", rows: [
48-
TapActionRow(title: "TapActionCell", action: { _ in })
48+
TapActionRow(text: "TapActionCell", action: { _ in })
4949
]),
5050

5151
Section(title: "Navigation", rows: [
52-
NavigationRow(title: "UITableViewCell", subtitle: .belowTitle(".subtitle"), action: { _ in })
52+
NavigationRow(text: "UITableViewCell", detailText: .subtitle(".subtitle"), action: { _ in })
5353
]),
5454

5555
RadioSection(title: "Radio Buttons", options: [
56-
OptionRow(title: "UITableViewCell", isSelected: true, action: { _ in })
56+
OptionRow(text: "UITableViewCell", isSelected: true, action: { _ in })
5757
])
5858
]
5959
}

Example-iOS/ViewControllers/CustomizationViewController.swift

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ internal final class CustomizationViewController: QuickTableViewController {
4141

4242
private let debugging = Section(
4343
title: nil,
44-
rows: [NavigationRow(title: "", subtitle: .none)],
44+
rows: [NavigationRow(text: "", detailText: .none)],
4545
footer: "Select or toggle each row to show their cell reuse identifiers."
4646
)
4747

@@ -56,13 +56,13 @@ internal final class CustomizationViewController: QuickTableViewController {
5656

5757
Section(title: "Switch", rows: [
5858
SwitchRow<CustomSwitchCell>(
59-
title: "SwitchRow\n<CustomSwitchCell>",
59+
text: "SwitchRow\n<CustomSwitchCell>",
6060
switchValue: true,
6161
customization: set(label: "0-0"),
6262
action: showLog()
6363
),
6464
CustomSwitchRow<SwitchCell>(
65-
title: "CustomSwitchRow\n<SwitchCell>",
65+
text: "CustomSwitchRow\n<SwitchCell>",
6666
switchValue: false,
6767
customization: set(label: "0-1"),
6868
action: showLog()
@@ -71,67 +71,67 @@ internal final class CustomizationViewController: QuickTableViewController {
7171

7272
Section(title: "Tap Action", rows: [
7373
TapActionRow<CustomTapActionCell>(
74-
title: "TapActionRow\n<CustomTapActionCell>",
74+
text: "TapActionRow\n<CustomTapActionCell>",
7575
customization: set(label: "1-0"),
7676
action: showLog()
7777
),
7878
CustomTapActionRow<TapActionCell>(
79-
title: "CustomTapActionRow\n<TapActionCell>",
79+
text: "CustomTapActionRow\n<TapActionCell>",
8080
customization: set(label: "1-1"),
8181
action: showLog()
8282
)
8383
]),
8484

8585
Section(title: "Navigation", rows: [
8686
NavigationRow(
87-
title: "NavigationRow",
88-
subtitle: .none,
87+
text: "NavigationRow",
88+
detailText: .none,
8989
customization: set(label: "2-0"),
9090
action: showLog()
9191
),
9292
NavigationRow<CustomCell>(
93-
title: "NavigationRow<CustomCell>",
94-
subtitle: .belowTitle(".subtitle"),
93+
text: "NavigationRow<CustomCell>",
94+
detailText: .subtitle(".subtitle"),
9595
customization: set(label: "2-1"),
9696
action: showLog()
9797
),
9898
CustomNavigationRow(
99-
title: "CustomNavigationRow",
100-
subtitle: .rightAligned(".value1"),
99+
text: "CustomNavigationRow",
100+
detailText: .value1(".value1"),
101101
customization: set(label: "2-2"),
102102
action: showLog()
103103
),
104104
CustomNavigationRow<CustomCell>(
105-
title: "CustomNavigationRow<CustomCell>",
106-
subtitle: .leftAligned(".value2"),
105+
text: "CustomNavigationRow<CustomCell>",
106+
detailText: .value2(".value2"),
107107
customization: set(label: "2-3"),
108108
action: showLog()
109109
)
110110
]),
111111

112112
RadioSection(title: "Radio Buttons", options: [
113113
OptionRow(
114-
title: "OptionRow",
114+
text: "OptionRow",
115115
isSelected: false,
116116
customization: set(label: "3-0"),
117117
action: showLog()
118118
),
119119
CustomOptionRow(
120-
title: "CustomOptionRow",
120+
text: "CustomOptionRow",
121121
isSelected: false,
122122
customization: set(label: "3-1"),
123123
action: showLog()
124124
),
125125
CustomOptionRow<CustomOptionCell>(
126-
title: "CustomOptionRow<CustomOptionCell>",
126+
text: "CustomOptionRow<CustomOptionCell>",
127127
isSelected: false,
128128
customization: set(label: "3-2"),
129129
action: showLog()
130130
)
131131
]),
132132

133133
Section(title: nil, rows: [
134-
NavigationRow(title: "Customization closure", subtitle: .none, customization: { cell, _ in
134+
NavigationRow(text: "Customization closure", detailText: .none, customization: { cell, _ in
135135
cell.accessibilityLabel = "4-0"
136136
cell.accessoryView = UIImageView(image: #imageLiteral(resourceName: "iconmonstr-x-mark"))
137137
})
@@ -162,7 +162,7 @@ internal final class CustomizationViewController: QuickTableViewController {
162162
}
163163
let identifier = ($0 as! RowStyle).cellReuseIdentifier
164164
self?.debugging.rows = [
165-
NavigationRow(title: identifier, subtitle: .none, customization: self?.set(label: "debug"))
165+
NavigationRow(text: identifier, detailText: .none, customization: self?.set(label: "debug"))
166166
]
167167
print(identifier)
168168
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { [weak self] in

Example-iOS/ViewControllers/DefaultViewController.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ internal final class DefaultViewController: QuickTableViewController {
3131

3232
// MARK: - Properties
3333

34-
private let debugging = Section(title: nil, rows: [NavigationRow(title: "", subtitle: .none)])
34+
private let debugging = Section(title: nil, rows: [NavigationRow(text: "", detailText: .none)])
3535

3636
// MARK: - UIViewController
3737

@@ -45,25 +45,25 @@ internal final class DefaultViewController: QuickTableViewController {
4545

4646
tableContents = [
4747
Section(title: "Switch", rows: [
48-
SwitchRow(title: "Setting 1", switchValue: true, icon: .image(globe), action: didToggleSwitch()),
49-
SwitchRow(title: "Setting 2", switchValue: false, icon: .image(time), action: didToggleSwitch())
48+
SwitchRow(text: "Setting 1", switchValue: true, icon: .image(globe), action: didToggleSwitch()),
49+
SwitchRow(text: "Setting 2", switchValue: false, icon: .image(time), action: didToggleSwitch())
5050
]),
5151

5252
Section(title: "Tap Action", rows: [
53-
TapActionRow(title: "Tap action", action: showAlert())
53+
TapActionRow(text: "Tap action", action: showAlert())
5454
]),
5555

5656
Section(title: "Navigation", rows: [
57-
NavigationRow(title: "CellStyle.default", subtitle: .none, icon: .image(gear)),
58-
NavigationRow(title: "CellStyle", subtitle: .belowTitle(".subtitle"), icon: .image(globe)),
59-
NavigationRow(title: "CellStyle", subtitle: .rightAligned(".value1"), icon: .image(time), action: showDetail()),
60-
NavigationRow(title: "CellStyle", subtitle: .leftAligned(".value2"))
57+
NavigationRow(text: "CellStyle.default", detailText: .none, icon: .image(gear)),
58+
NavigationRow(text: "CellStyle", detailText: .subtitle(".subtitle"), icon: .image(globe)),
59+
NavigationRow(text: "CellStyle", detailText: .value1(".value1"), icon: .image(time), action: showDetail()),
60+
NavigationRow(text: "CellStyle", detailText: .value2(".value2"))
6161
], footer: "UITableViewCellStyle.Value2 hides the image view."),
6262

6363
RadioSection(title: "Radio Buttons", options: [
64-
OptionRow(title: "Option 1", isSelected: true, action: didToggleSelection()),
65-
OptionRow(title: "Option 2", isSelected: false, action: didToggleSelection()),
66-
OptionRow(title: "Option 3", isSelected: false, action: didToggleSelection())
64+
OptionRow(text: "Option 1", isSelected: true, action: didToggleSelection()),
65+
OptionRow(text: "Option 2", isSelected: false, action: didToggleSelection()),
66+
OptionRow(text: "Option 3", isSelected: false, action: didToggleSelection())
6767
], footer: "See RadioSection for more details."),
6868

6969
debugging
@@ -83,7 +83,7 @@ internal final class DefaultViewController: QuickTableViewController {
8383
private func didToggleSelection() -> (Row) -> Void {
8484
return { [weak self] in
8585
if let option = $0 as? OptionRowCompatible {
86-
let state = "\(option.title) is " + (option.isSelected ? "selected" : "deselected")
86+
let state = "\(option.text) is " + (option.isSelected ? "selected" : "deselected")
8787
self?.showDebuggingText(state)
8888
}
8989
}
@@ -92,7 +92,7 @@ internal final class DefaultViewController: QuickTableViewController {
9292
private func didToggleSwitch() -> (Row) -> Void {
9393
return { [weak self] in
9494
if let row = $0 as? SwitchRowCompatible {
95-
let state = "\(row.title) = \(row.switchValue)"
95+
let state = "\(row.text) = \(row.switchValue)"
9696
self?.showDebuggingText(state)
9797
}
9898
}
@@ -110,7 +110,7 @@ internal final class DefaultViewController: QuickTableViewController {
110110

111111
private func showDetail() -> (Row) -> Void {
112112
return { [weak self] in
113-
let detail = $0.title + ($0.subtitle?.text ?? "")
113+
let detail = $0.text + ($0.detailText?.text ?? "")
114114
let controller = UIViewController()
115115
controller.view.backgroundColor = .white
116116
controller.title = detail
@@ -121,7 +121,7 @@ internal final class DefaultViewController: QuickTableViewController {
121121

122122
private func showDebuggingText(_ text: String) {
123123
print(text)
124-
debugging.rows = [NavigationRow(title: text, subtitle: .none)]
124+
debugging.rows = [NavigationRow(text: text, detailText: .none)]
125125
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { [weak self] in
126126
self?.tableView.reloadData()
127127
}

Example-iOS/ViewControllers/RootViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,19 @@ internal final class RootViewController: QuickTableViewController {
4040

4141
tableContents = [
4242
Section(title: "Default", rows: [
43-
NavigationRow(title: "Use default cell types", subtitle: .none, action: { [weak self] _ in
43+
NavigationRow(text: "Use default cell types", detailText: .none, action: { [weak self] _ in
4444
self?.navigationController?.pushViewController(DefaultViewController(), animated: true)
4545
})
4646
]),
4747

4848
Section(title: "Customization", rows: [
49-
NavigationRow(title: "Use custom cell types", subtitle: .none, action: { [weak self] _ in
49+
NavigationRow(text: "Use custom cell types", detailText: .none, action: { [weak self] _ in
5050
self?.navigationController?.pushViewController(CustomizationViewController(), animated: true)
5151
})
5252
]),
5353

5454
Section(title: "UIAppearance", rows: [
55-
NavigationRow(title: "UILabel customization", subtitle: .none, action: { [weak self] _ in
55+
NavigationRow(text: "UILabel customization", detailText: .none, action: { [weak self] _ in
5656
self?.navigationController?.pushViewController(AppearanceViewController(), animated: true)
5757
})
5858
])

Example-tvOS/TableViewController.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,25 @@ internal final class TableViewController: QuickTableViewController {
3535

3636
tableContents = [
3737
Section(title: "Switch", rows: [
38-
SwitchRow(title: "Setting 1", switchValue: true, action: showLog()),
39-
SwitchRow(title: "Setting 2", switchValue: false, action: showLog())
38+
SwitchRow(text: "Setting 1", switchValue: true, action: showLog()),
39+
SwitchRow(text: "Setting 2", switchValue: false, action: showLog())
4040
]),
4141

4242
Section(title: "Tap Action", rows: [
43-
TapActionRow(title: "Tap action", action: showAlert())
43+
TapActionRow(text: "Tap action", action: showAlert())
4444
]),
4545

4646
Section(title: "Navigation", rows: [
47-
NavigationRow(title: "CellStyle.default", subtitle: .none, action: showDetail()),
48-
NavigationRow(title: "CellStyle", subtitle: .belowTitle(".subtitle"), action: showDetail()),
49-
NavigationRow(title: "CellStyle", subtitle: .rightAligned(".value1")),
50-
NavigationRow(title: "CellStyle", subtitle: .leftAligned(".value2"))
47+
NavigationRow(text: "CellStyle.default", detailText: .none, action: showDetail()),
48+
NavigationRow(text: "CellStyle", detailText: .subtitle(".subtitle"), action: showDetail()),
49+
NavigationRow(text: "CellStyle", detailText: .value1(".value1")),
50+
NavigationRow(text: "CellStyle", detailText: .value2(".value2"))
5151
]),
5252

5353
RadioSection(title: "Radio Buttons", options: [
54-
OptionRow(title: "Option 1", isSelected: true, action: showLog()),
55-
OptionRow(title: "Option 2", isSelected: false, action: showLog()),
56-
OptionRow(title: "Option 3", isSelected: false, action: showLog())
54+
OptionRow(text: "Option 1", isSelected: true, action: showLog()),
55+
OptionRow(text: "Option 2", isSelected: false, action: showLog()),
56+
OptionRow(text: "Option 3", isSelected: false, action: showLog())
5757
], footer: "See RadioSection for more details.")
5858
]
5959
}
@@ -63,8 +63,8 @@ internal final class TableViewController: QuickTableViewController {
6363
private func showAlert() -> (Row) -> Void {
6464
return { [weak self] row in
6565
let alert = UIAlertController(
66-
title: row.title,
67-
message: row.subtitle.flatMap({ $0.text }),
66+
title: row.text,
67+
message: row.detailText.flatMap({ $0.text }),
6868
preferredStyle: .alert
6969
)
7070
alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: nil))
@@ -75,7 +75,7 @@ internal final class TableViewController: QuickTableViewController {
7575
private func showDetail() -> (Row) -> Void {
7676
return { [weak self] row in
7777
let controller = UIViewController()
78-
controller.title = row.title + (row.subtitle?.text ?? "")
78+
controller.title = row.text + (row.detailText?.text ?? "")
7979
self?.navigationController?.pushViewController(controller, animated: true)
8080
}
8181
}
@@ -84,9 +84,9 @@ internal final class TableViewController: QuickTableViewController {
8484
return {
8585
switch $0 {
8686
case let row as SwitchRowCompatible:
87-
print("\(row.title) = \(row.switchValue)")
87+
print("\(row.text) = \(row.switchValue)")
8888
case let option as OptionRowCompatible where option.isSelected:
89-
print("\(option.title) is selected")
89+
print("\(option.text) is selected")
9090
default:
9191
break
9292
}

0 commit comments

Comments
 (0)