Skip to content

Commit e75b9f8

Browse files
authored
fix: repair SwiftLint configuration (#35)
1 parent c36ce98 commit e75b9f8

4 files changed

Lines changed: 69 additions & 15 deletions

File tree

.swiftlint.yml

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,63 @@
1-
disabled_rules:
2-
- trailing_whitespace
3-
line_length: 140
4-
excluded:
1+
included:
52
- Sources
6-
- SlidableImage
7-
- SlidableImageTests
3+
84
excluded:
5+
- .build
6+
- Carthage
97
- Pods
8+
9+
opt_in_rules:
10+
- array_init
11+
- closure_spacing
12+
- collection_alignment
13+
- contains_over_filter_count
14+
- contains_over_filter_is_empty
15+
- contains_over_first_not_nil
16+
- contains_over_range_nil_comparison
17+
- empty_collection_literal
18+
- empty_count
19+
- empty_string
20+
- explicit_init
21+
- extension_access_modifier
22+
- first_where
23+
- flatmap_over_map_reduce
24+
- identical_operands
25+
- joined_default_parameter
26+
- last_where
27+
- legacy_multiple
28+
- lower_acl_than_parent
29+
- modifier_order
30+
- operator_usage_whitespace
31+
- optional_enum_case_matching
32+
- pattern_matching_keywords
33+
- prefer_self_type_over_type_of_self
34+
- redundant_nil_coalescing
35+
- redundant_type_annotation
36+
- sorted_first_last
37+
- toggle_bool
38+
- trailing_closure
39+
- unavailable_function
40+
- unneeded_parentheses_in_closure_argument
41+
- yoda_condition
42+
43+
line_length:
44+
warning: 120
45+
error: 130
46+
ignores_comments: true
47+
ignores_urls: true
48+
49+
type_body_length:
50+
warning: 300
51+
error: 400
52+
53+
file_length:
54+
warning: 400
55+
error: 500
56+
57+
function_body_length:
58+
warning: 60
59+
error: 100
60+
61+
cyclomatic_complexity:
62+
warning: 10
63+
error: 20

Sources/SlidableImage/Arrows.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import SwiftUI
88
public struct Arrows: View {
99
private let arrowColor: Color
1010
private let backgroundColor: Color
11-
11+
1212
public init(arrowColor: Color = .white, backgroundColor: Color = .gray) {
1313
self.arrowColor = arrowColor
1414
self.backgroundColor = backgroundColor
1515
}
16-
16+
1717
public var body: some View {
1818
HStack(spacing: 5) {
1919
Triangle()

Sources/SlidableImage/SlidableImage.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ public struct SlidableImage<ArrowsIcon: View, LeftView: View, RightView: View>:
1010
private let arrows: () -> ArrowsIcon
1111
private let leftView: () -> LeftView
1212
private let rightView: () -> RightView
13-
13+
1414
public init(@ViewBuilder arrows: @escaping () -> ArrowsIcon,
1515
@ViewBuilder leftView: @escaping () -> LeftView,
1616
@ViewBuilder rightView: @escaping () -> RightView) {
1717
self.arrows = arrows
1818
self.leftView = leftView
1919
self.rightView = rightView
2020
}
21-
21+
2222
public var body: some View {
2323
GeometryReader { geometry in
2424
ZStack(alignment: .leading) {
@@ -30,27 +30,27 @@ public struct SlidableImage<ArrowsIcon: View, LeftView: View, RightView: View>:
3030
Spacer(minLength: maskSize(width: geometry.size.width))
3131
}
3232
}
33-
33+
3434
arrows()
3535
.frame(width: Constants.arrowSize, height: Constants.arrowSize)
3636
.padding(.leading, location?.x ?? geometry.size.width / 2 - Constants.arrowSize / 2)
3737
.gesture(
3838
DragGesture()
3939
.onChanged { value in
4040
guard value.location.x <= geometry.size.width - Constants.arrowSize else { return }
41-
41+
4242
location = CGPoint(x: value.location.x, y: geometry.size.height / 2)
4343
}
4444
)
4545
}
4646
}
4747
}
48-
48+
4949
private func maskSize(width: CGFloat) -> CGFloat {
5050
guard let location = location?.x else {
5151
return width / 2
5252
}
53-
53+
5454
return width - location - Constants.arrowSize / 2
5555
}
5656
}

Sources/SlidableImage/Triangle.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ struct Triangle_Previews: PreviewProvider {
2020
static var previews: some View {
2121
Triangle()
2222
.frame(width: 100, height: 100)
23-
}
23+
}
2424
}

0 commit comments

Comments
 (0)