Skip to content

Commit 752ba10

Browse files
committed
refactoring
1 parent 51b32dd commit 752ba10

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

Sources/swiftui-search-field-shell-line/SearchFieldShell.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ public struct SearchFieldShell: View {
206206

207207
}
208208

209+
#if DEBUG
209210
struct SearchField_Previews: PreviewProvider {
210211
static var previews: some View {
211212
GeometryReader { proxy in
@@ -217,12 +218,4 @@ struct SearchField_Previews: PreviewProvider {
217218

218219
}
219220
}
220-
221-
#if os(OSX)
222-
extension NSTextField {
223-
override open var focusRingType: NSFocusRingType {
224-
get { .none }
225-
set { }
226-
}
227-
}
228221
#endif

Sources/swiftui-search-field-shell-line/SearchFieldShellLine.swift

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import SwiftUI
99

1010
/// Line with animation of lenght
11+
/// Utility component for ``SearchFieldShell``
1112
struct SearchFieldShellLine: Shape {
1213

1314
/// Lines thickness
@@ -21,13 +22,20 @@ struct SearchFieldShellLine: Shape {
2122
}
2223

2324
// MARK: - Config
24-
25+
26+
/// Available width size for component
2527
let width : Double
2628

29+
/// Available height size for component
2730
let height: CGFloat
28-
31+
32+
/// Animatable variable for animatiing line length
2933
var x : Double = 0
3034

35+
36+
/// Create line for ``SearchFieldShell``
37+
/// - Parameter rect: Rect space
38+
/// - Returns: Line
3139
func path(in rect: CGRect) -> Path {
3240
let delta = self.height / 2
3341
let y = self.height
@@ -37,9 +45,19 @@ struct SearchFieldShellLine: Shape {
3745
}
3846
}
3947
}
40-
48+
#if DEBUG
4149
struct SearchFieldShellLine_Previews: PreviewProvider {
4250
static var previews: some View {
4351
SearchFieldShellLine(width: .zero, height: 75, x: .zero)
4452
}
4553
}
54+
#endif
55+
56+
#if os(OSX)
57+
extension NSTextField {
58+
override open var focusRingType: NSFocusRingType {
59+
get { .none }
60+
set { }
61+
}
62+
}
63+
#endif

0 commit comments

Comments
 (0)