@@ -19,24 +19,26 @@ public struct NitrozenRadio<Element>: View where Element: NitrozenElementRadioSt
19
19
var options : Array < Element >
20
20
@Binding var selection : Set < Element >
21
21
var layout : Layout
22
+ var itemSpacing : CGFloat
22
23
var appearance : NitrozenAppearance . RadioButton
23
24
24
25
public init ( options: Array < Element > , selection: Binding < Set < Element > > ,
25
- layout: Layout , appearance: NitrozenAppearance . RadioButton ? = nil ) {
26
+ layout: Layout , itemSpacing : CGFloat = 8 , appearance: NitrozenAppearance . RadioButton ? = nil ) {
26
27
self . options = options
27
28
self . _selection = selection
28
29
self . layout = layout
30
+ self . itemSpacing = itemSpacing
29
31
self . appearance = appearance. or ( NitrozenAppearance . shared. radioButton)
30
32
}
31
33
32
34
public var body : some View {
33
35
switch self . layout {
34
36
case . horizontal:
35
- HStack {
37
+ HStack ( spacing : self . itemSpacing ) {
36
38
listView ( )
37
39
}
38
40
case . verticle:
39
- VStack {
41
+ VStack ( spacing : self . itemSpacing ) {
40
42
listView ( )
41
43
}
42
44
}
@@ -45,11 +47,10 @@ public struct NitrozenRadio<Element>: View where Element: NitrozenElementRadioSt
45
47
@ViewBuilder
46
48
func listView( ) -> some View {
47
49
ForEach ( self . options, id: \. hashValue) { item in
48
-
49
50
NitrozenRadioButtonItem (
50
51
isSelected: selection. contains ( item) ,
51
52
title: item. selectionTitleText,
52
- subTitle: item. selectionSubTitleText. or ( " " ) ,
53
+ subTitle: item. selectionSubTitleText,
53
54
appearance: self . appearance
54
55
)
55
56
. onTapGesture {
@@ -87,7 +88,7 @@ public struct NitrozenRadioButtonItem: View {
87
88
88
89
public var body : some View {
89
90
90
- VStack ( alignment: . leading, spacing: 8 ) {
91
+ VStack ( alignment: . leading, spacing: 0 ) {
91
92
HStack ( alignment: . center) {
92
93
radioButton ( )
93
94
titleLabel ( )
0 commit comments