From 0a465b8412027b365662d68c8b7cff6b7d5c3d12 Mon Sep 17 00:00:00 2001 From: Dave Nicolson Date: Fri, 22 May 2020 17:31:55 +0200 Subject: [PATCH 1/4] Fix SwitchRow subtitles --- Example-iOS/ViewControllers/ExampleViewController.swift | 2 +- Source/Rows/SwitchRow.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Example-iOS/ViewControllers/ExampleViewController.swift b/Example-iOS/ViewControllers/ExampleViewController.swift index 09c4d3f2..1d3115ec 100644 --- a/Example-iOS/ViewControllers/ExampleViewController.swift +++ b/Example-iOS/ViewControllers/ExampleViewController.swift @@ -45,7 +45,7 @@ internal final class ExampleViewController: QuickTableViewController { tableContents = [ Section(title: "Switch", rows: [ - SwitchRow(text: "Setting 1", switchValue: true, icon: .image(globe), action: didToggleSwitch()), + SwitchRow(text: "Setting 1", detailText: .subtitle("Example subtitle"), switchValue: true, icon: .image(globe), action: didToggleSwitch()), SwitchRow(text: "Setting 2", switchValue: false, icon: .image(time), action: didToggleSwitch()) ]), diff --git a/Source/Rows/SwitchRow.swift b/Source/Rows/SwitchRow.swift index bcbbded1..ece77b16 100644 --- a/Source/Rows/SwitchRow.swift +++ b/Source/Rows/SwitchRow.swift @@ -83,7 +83,7 @@ open class SwitchRow: SwitchRowCompatible, Equatable { public let cellReuseIdentifier: String = T.reuseIdentifier /// The cell style is `.default`. - public let cellStyle: UITableViewCell.CellStyle = .default + public let cellStyle: UITableViewCell.CellStyle = .subtitle /// The icon of the row. public let icon: Icon? From 0d06ab79c9f663a1ced04986310e41aae7a8f4ca Mon Sep 17 00:00:00 2001 From: Dave Nicolson Date: Fri, 22 May 2020 21:54:03 +0200 Subject: [PATCH 2/4] Update Source/Rows/SwitchRow.swift Co-authored-by: Ben --- Source/Rows/SwitchRow.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Rows/SwitchRow.swift b/Source/Rows/SwitchRow.swift index ece77b16..4e56e51c 100644 --- a/Source/Rows/SwitchRow.swift +++ b/Source/Rows/SwitchRow.swift @@ -82,7 +82,7 @@ open class SwitchRow: SwitchRowCompatible, Equatable { /// The reuse identifier of the table view cell to display the row. The default value is **SwitchCell**. public let cellReuseIdentifier: String = T.reuseIdentifier - /// The cell style is `.default`. + /// Returns the table view cell style for the specified detail text. public let cellStyle: UITableViewCell.CellStyle = .subtitle /// The icon of the row. From b0ef21e6a8b337a9f7a79b7a2e9c2d0aee0d69e0 Mon Sep 17 00:00:00 2001 From: Dave Nicolson Date: Fri, 22 May 2020 21:54:12 +0200 Subject: [PATCH 3/4] Update Source/Rows/SwitchRow.swift Co-authored-by: Ben --- Source/Rows/SwitchRow.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Rows/SwitchRow.swift b/Source/Rows/SwitchRow.swift index 4e56e51c..7f72e7e0 100644 --- a/Source/Rows/SwitchRow.swift +++ b/Source/Rows/SwitchRow.swift @@ -83,7 +83,9 @@ open class SwitchRow: SwitchRowCompatible, Equatable { public let cellReuseIdentifier: String = T.reuseIdentifier /// Returns the table view cell style for the specified detail text. - public let cellStyle: UITableViewCell.CellStyle = .subtitle + public var cellStyle: UITableViewCell.CellStyle { + return detailText?.style ?? .subtitle + } /// The icon of the row. public let icon: Icon? From 2d2d92f1a6168a1302584dce6a75dd80303b1335 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 22 May 2020 22:19:24 +0100 Subject: [PATCH 4/4] Fix UI interaction tests --- Example-iOSUITests/ExampleUITests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Example-iOSUITests/ExampleUITests.swift b/Example-iOSUITests/ExampleUITests.swift index eeb91b22..ff5b7e98 100644 --- a/Example-iOSUITests/ExampleUITests.swift +++ b/Example-iOSUITests/ExampleUITests.swift @@ -42,11 +42,11 @@ internal final class ExampleUITests: XCTestCase { let tables = XCUIApplication().tables let existance = NSPredicate(format: "exists == true") - tables.switches["Setting 1"].tap() + tables.switches.firstMatch.tap() expectation(for: existance, evaluatedWith: tables.staticTexts["Setting 1 = false"], handler: nil) waitForExpectations(timeout: 5, handler: nil) - tables.switches["Setting 1"].tap() + tables.switches.firstMatch.tap() expectation(for: existance, evaluatedWith: tables.staticTexts["Setting 1 = true"], handler: nil) waitForExpectations(timeout: 5, handler: nil)