Skip to content

Commit 1aa4a2f

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 76b110f commit 1aa4a2f

7 files changed

Lines changed: 20 additions & 24 deletions

File tree

Demo/Demo/AppConfigs.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ enum Region: String, CaseIterable, RawStringValueRepresentable {
8080
case west
8181
}
8282

83-
// Wanna make it more readable instead of just showing integer values?
84-
// Then conform to `CustomStringConvertible`
83+
/// Wanna make it more readable instead of just showing integer values?
84+
/// Then conform to `CustomStringConvertible`
8585
enum AccountType: Int, CaseIterable, RawStringValueRepresentable, CustomStringConvertible {
8686
case guest = 0
8787
case member = 1

Demo/DemoTests/SnapshotTests.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ final class SnapshotTests: XCTestCase {
1313

1414
// MARK: - Snapshots ViewControllers
1515

16-
func testInAppModificationDisabled() throws {
16+
func testInAppModificationDisabled() {
1717
assertVCSnapshotWithActionFromHost {
1818
try? XConfigs.show(from: $0, animated: false)
1919
}
@@ -32,28 +32,28 @@ final class SnapshotTests: XCTestCase {
3232
}
3333
}
3434

35-
func testInputValueViewController() throws {
35+
func testInputValueViewController() {
3636
let vc = InputValueViewController(viewModel: .init(model: .init(key: "Hello", value: "World", displayName: "Hello"))).wrapInsideNavVC().preferAsHalfSheet()
3737
assertVCSnapshotWithActionFromHost {
3838
$0.present(vc, animated: false)
3939
}
4040
}
4141

42-
func testInputValueViewControllerJSON() throws {
42+
func testInputValueViewControllerJSON() {
4343
let vc = InputValueViewController(viewModel: .init(model: .init(key: "JSON", value: "{\"name\":\"Kel\", \"city\": \"Melbourne\" }", displayName: "Contact"))).wrapInsideNavVC().preferAsHalfSheet()
4444
assertVCSnapshotWithActionFromHost {
4545
$0.present(vc, animated: false)
4646
}
4747
}
4848

49-
func testInputValueViewControllerURL() throws {
49+
func testInputValueViewControllerURL() {
5050
let vc = InputValueViewController(viewModel: .init(model: .init(key: "URL", value: "https://google.com", displayName: "URL"))).wrapInsideNavVC().preferAsHalfSheet()
5151
assertVCSnapshotWithActionFromHost {
5252
$0.present(vc, animated: false)
5353
}
5454
}
5555

56-
func testOptionViewController() throws {
56+
func testOptionViewController() {
5757
let choices = [1, 2, 3, 4].map { "Value\($0)" }.map { Choice(displayName: $0, value: $0) }
5858
let vc = OptionViewController(viewModel: .init(model: .init(key: "Name", value: "Value1", choices: choices, displayName: "Name"))).wrapInsideNavVC().preferAsHalfSheet()
5959
assertVCSnapshotWithActionFromHost {
@@ -63,39 +63,39 @@ final class SnapshotTests: XCTestCase {
6363

6464
// MARK: - Snapshots - Views
6565

66-
func testActionView() throws {
66+
func testActionView() {
6767
let view = ActionView().apply {
6868
$0.configure(with: "Action name")
6969
$0.widthAnchor.constraint(equalToConstant: 320).isActive = true
7070
}
7171
assertSnapshot(matching: view, as: .image(precision: 0.95))
7272
}
7373

74-
func testKeyValueView() throws {
74+
func testKeyValueView() {
7575
let view = KeyValueView().apply {
7676
$0.configure(with: ("Name", "Value"))
7777
$0.widthAnchor.constraint(equalToConstant: 320).isActive = true
7878
}
7979
assertSnapshot(matching: view, as: .image(precision: 0.95))
8080
}
8181

82-
func testKeyValueViewWithLongValue() throws {
82+
func testKeyValueViewWithLongValue() {
8383
let view = KeyValueView().apply {
8484
$0.configure(with: ("Name", "This a long value. Lorem ipsum sit dolor amet."))
8585
$0.widthAnchor.constraint(equalToConstant: 320).isActive = true
8686
}
8787
assertSnapshot(matching: view, as: .image(precision: 0.95))
8888
}
8989

90-
func testToggleView() throws {
90+
func testToggleView() {
9191
let view = ToggleView().apply {
9292
$0.configure(with: ("Name", false))
9393
$0.widthAnchor.constraint(equalToConstant: 320).isActive = true
9494
}
9595
assertSnapshot(matching: view, as: .image(precision: 0.95))
9696
}
9797

98-
func testToggleViewWithOnValue() throws {
98+
func testToggleViewWithOnValue() {
9999
let view = ToggleView().apply {
100100
$0.configure(with: ("Name", true))
101101
$0.widthAnchor.constraint(equalToConstant: 320).isActive = true

Demo/DemoTests/XConfigsTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ final class XConfigsTests: XCTestCase {
4949
))
5050
}
5151

52-
func testTitles() throws {
52+
func testTitles() {
5353
var title = ""
5454
var searchPlaceholderTitle = ""
5555
output.title.sink { title = $0 }.store(in: &subscriptions)

Sources/XConfigs/Extensions/UIView++.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import Combine
33
import UIKit
44

5-
// Provide a default `reuseIdentifier` equal to the class name.
5+
/// Provide a default `reuseIdentifier` equal to the class name.
66
private extension UITableViewCell {
77
static var reuseIdentifier: String {
88
String(describing: self)

Sources/XConfigs/Models/SectionItemsModel.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ struct SectionItemsModel<Section: Hashable, Item: Hashable>: Hashable {
77

88
// MARK: Equatable
99

10-
extension SectionItemsModel: Equatable {
11-
public static func == (lhs: Self, rhs: Self) -> Bool {
12-
lhs.section == rhs.section && lhs.items == rhs.items
13-
}
14-
}
10+
extension SectionItemsModel: Equatable {}
1511

1612
// MARK: - SectionItemsModel + NSDiffableDataSourceSnapshot
1713

Sources/XConfigs/ViewControllers/XConfigsViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@
119119
return self.datasource.itemIdentifier(for: indexPath)
120120
}.eraseToAnyPublisher(),
121121
dismissPublisher: doneButton.tapPublisher
122-
))
122+
)
123+
)
123124

124125
output.searchPlaceholderTitle.compactMap { $0 }.assign(to: \UISearchBar.placeholder, on: searchController.searchBar).store(in: &subscriptions)
125126
output.title.compactMap { $0 }.assign(to: \UIViewController.title, on: self).store(in: &subscriptions)
@@ -188,11 +189,10 @@
188189
}
189190

190191
private func createCopyAction(_ value: String) -> UIAction {
191-
let copyAction = UIAction(title: "Copy \"\(value)\"") { _ in
192+
UIAction(title: "Copy \"\(value)\"") { _ in
192193
let pasteboard = UIPasteboard.general
193194
pasteboard.string = value
194195
}
195-
return copyAction
196196
}
197197

198198
@available(iOS 13.0, *)

Sources/XConfigs/ViewModels/XConfigsViewModel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ struct XConfigsViewModel: ViewModelType {
9191
)
9292
}
9393

94-
// Transform [ConfigInfo] to [SectionItemModel]
94+
/// Transform [ConfigInfo] to [SectionItemModel]
9595
func mapConfigInfosToSectionItemsModels(searchText: String, infos: [ConfigInfo]) -> [SectionItemsModel<Section, Item>] {
9696
var mainItems: [Item] = [.inAppModification(
9797
title: NSLocalizedString("Enable In-app modification?", comment: ""),
@@ -127,7 +127,7 @@ struct XConfigsViewModel: ViewModelType {
127127
return sections
128128
}
129129

130-
// Transform ConfigInfo to Item
130+
/// Transform ConfigInfo to Item
131131
func mapConfigInfoToItem(_ info: ConfigInfo) -> Item? {
132132
guard !info.readonly else {
133133
var value = info.configValue.rawString

0 commit comments

Comments
 (0)