Skip to content

Commit 9dc0739

Browse files
change scope of models' helpers
1 parent 3e5f06c commit 9dc0739

File tree

10 files changed

+28
-24
lines changed

10 files changed

+28
-24
lines changed

Examples/DemosApp/DemosApp/ComponentsPreview/PreviewPages/ButtonPreview.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ struct ButtonPreview: View {
2727
Toggle("Full Width", isOn: self.$model.isFullWidth)
2828
SizePicker(selection: self.$model.size)
2929
Picker("Style", selection: self.$model.style) {
30-
Text("Filled").tag(ButtonStyle.filled)
31-
Text("Plain").tag(ButtonStyle.plain)
32-
Text("Bordered with small border").tag(ButtonStyle.bordered(.small))
33-
Text("Bordered with medium border").tag(ButtonStyle.bordered(.medium))
34-
Text("Bordered with large border").tag(ButtonStyle.bordered(.large))
35-
Text("Bordered with custom border: 6px").tag(ButtonStyle.bordered(.custom(6)))
30+
Text("Filled").tag(ButtonVM.Style.filled)
31+
Text("Plain").tag(ButtonVM.Style.plain)
32+
Text("Bordered with small border").tag(ButtonVM.Style.bordered(.small))
33+
Text("Bordered with medium border").tag(ButtonVM.Style.bordered(.medium))
34+
Text("Bordered with large border").tag(ButtonVM.Style.bordered(.large))
35+
Text("Bordered with custom border: 6px").tag(ButtonVM.Style.bordered(.custom(6)))
3636
}
3737
}
3838
}

Examples/DemosApp/DemosApp/ComponentsPreview/PreviewPages/DividerPreview.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ struct DividerPreview: View {
1616
}
1717
Form {
1818
Picker("Orientation", selection: self.$model.orientation) {
19-
Text("Horizontal").tag(DividerVM.DividerOrientation.horizontal)
20-
Text("Vertical").tag(DividerVM.DividerOrientation.vertical)
19+
Text("Horizontal").tag(DividerVM.Orientation.horizontal)
20+
Text("Vertical").tag(DividerVM.Orientation.vertical)
2121
}
2222
SizePicker(selection: self.$model.size)
2323
Picker("Color", selection: self.$model.color) {

Examples/DemosApp/DemosApp/ComponentsPreview/PreviewPages/LoadingPreview.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct LoadingPreview: View {
2222
}
2323
SizePicker(selection: self.$model.size)
2424
Picker("Style", selection: self.$model.style) {
25-
Text("Spinner").tag(LoadingStyle.spinner)
25+
Text("Spinner").tag(LoadingVM.Style.spinner)
2626
}
2727
}
2828
}
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import Foundation
22

3-
/// The buttons appearance style.
4-
public enum ButtonStyle: Hashable {
5-
/// A button with a filled background.
6-
case filled
7-
/// A button with a transparent background.
8-
case plain
9-
/// A button with a transparent background and a border.
10-
case bordered(BorderWidth)
3+
extension ButtonVM {
4+
/// The buttons appearance style.
5+
public enum Style: Hashable {
6+
/// A button with a filled background.
7+
case filled
8+
/// A button with a transparent background.
9+
case plain
10+
/// A button with a transparent background and a border.
11+
case bordered(BorderWidth)
12+
}
1113
}

Sources/ComponentsKit/Button/Models/ButtonVM.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public struct ButtonVM: ComponentVM {
4343
/// The visual style of the button.
4444
///
4545
/// Defaults to `.filled`.
46-
public var style: ButtonStyle = .filled
46+
public var style: Style = .filled
4747

4848
/// Initializes a new instance of `ButtonVM` with default values.
4949
public init() {}

Sources/ComponentsKit/Checkbox/Models/CheckboxAnimationDurations.swift renamed to Sources/ComponentsKit/Checkbox/Helpers/CheckboxAnimationDurations.swift

File renamed without changes.

Sources/ComponentsKit/Divider/Models/DividerStyle.swift renamed to Sources/ComponentsKit/Divider/Models/DividerOrientation.swift

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

33
extension DividerVM {
44
/// Defines the possible orientations for the divider.
5-
public enum DividerOrientation {
5+
public enum Orientation {
66
case horizontal
77
case vertical
88
}

Sources/ComponentsKit/Divider/Models/DividerVM.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public struct DividerVM: ComponentVM {
55
/// The orientation of the divider (horizontal or vertical).
66
///
77
/// Defaults to `.horizontal`.
8-
public var orientation: DividerOrientation = .horizontal
8+
public var orientation: Orientation = .horizontal
99

1010
/// The color of the divider.
1111
///
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import Foundation
22

3-
/// The loading appearance style.
4-
public enum LoadingStyle {
5-
case spinner
3+
extension LoadingVM {
4+
/// The loading appearance style.
5+
public enum Style {
6+
case spinner
7+
}
68
}

Sources/ComponentsKit/Loading/Models/LoadingVM.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public struct LoadingVM: ComponentVM {
2020
/// The style of the loading indicator (e.g., spinner, bar).
2121
///
2222
/// Defaults to `.spinner`.
23-
public var style: LoadingStyle = .spinner
23+
public var style: Style = .spinner
2424

2525
/// Initializes a new instance of `LoadingVM` with default values.
2626
public init() {}

0 commit comments

Comments
 (0)