File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,14 @@ public class SwiftUIRootView: SwiftUIContainerView {
107
107
}
108
108
}
109
109
} ) )
110
+ case let stepper as GenericNode < StepperProps > :
111
+ AnyView ( StepperView ( props: stepper. props, content: {
112
+ if let children = stepper. children {
113
+ ForEach ( children, id: \. id) { child in
114
+ self . buildSwiftUIView ( from: child)
115
+ }
116
+ }
117
+ } ) )
110
118
case let text as GenericNode < TextProps > :
111
119
AnyView ( TextView ( props: text. props) )
112
120
case let textField as GenericNode < TextFieldProps > :
@@ -115,8 +123,6 @@ public class SwiftUIRootView: SwiftUIContainerView {
115
123
AnyView ( PickerView ( props: picker. props) )
116
124
case let datePicker as GenericNode < DatePickerProps > :
117
125
AnyView ( DatePickerView ( props: datePicker. props) )
118
- case let stepper as GenericNode < StepperProps > :
119
- AnyView ( StepperView ( props: stepper. props) )
120
126
case let toggle as GenericNode < ToggleProps > :
121
127
AnyView ( ToggleView ( props: toggle. props) )
122
128
case let slider as GenericNode < SliderProps > :
Original file line number Diff line number Diff line change @@ -2,12 +2,14 @@ import SwiftUI
2
2
3
3
// MARK: - View
4
4
5
- public struct StepperView : View {
5
+ public struct StepperView < Content : View > : View {
6
6
@ObservedObject public var props : StepperProps
7
7
@FocusState private var isFocused : Bool
8
+ let content : ( ) -> Content
8
9
9
- public init ( props: StepperProps ) {
10
+ public init ( props: StepperProps , @ ViewBuilder content : @escaping ( ) -> Content ) {
10
11
self . props = props
12
+ self . content = content
11
13
}
12
14
13
15
public var body : some View {
@@ -34,7 +36,7 @@ public struct StepperView: View {
34
36
in: props. minimum ... props. maximum,
35
37
step: props. step
36
38
) {
37
- Text ( " \( props . value ) " )
39
+ content ( )
38
40
}
39
41
. applyStyles ( props. style)
40
42
. focused ( $isFocused)
You can’t perform that action at this time.
0 commit comments