@@ -20,34 +20,36 @@ public struct ListActionRow: View {
20
20
/// Create a list action row with a custom trailing view.
21
21
///
22
22
/// - Parameters:
23
- /// - title: The row title.
23
+ /// - title: The row title, if any .
24
24
/// - text: The row text.
25
25
/// - action: The ``ListAction`` to use.
26
26
/// - trailingView: An optional trailing view to apply to the view.
27
27
public init (
28
- title: LocalizedStringKey ,
28
+ title: LocalizedStringKey ? = nil ,
29
29
text: LocalizedStringKey ,
30
30
bundle: Bundle ? = nil ,
31
- action: ListAction ?
31
+ action: ListAction ? = nil
32
32
) {
33
33
self . title = title
34
34
self . text = text
35
35
self . bundle = bundle
36
36
self . action = action
37
37
}
38
38
39
- private let title : LocalizedStringKey
39
+ private let title : LocalizedStringKey ?
40
40
private let text : LocalizedStringKey
41
41
private let bundle : Bundle ?
42
42
private let action : ListAction ?
43
43
44
44
public var body : some View {
45
45
HStack ( spacing: 10 ) {
46
46
VStack ( alignment: . leading, spacing: 5 ) {
47
- Text ( title, bundle: bundle)
48
- . lineLimit ( 1 )
49
- . font ( . footnote)
50
- . foregroundColor ( . secondary)
47
+ if let title {
48
+ Text ( title, bundle: bundle)
49
+ . lineLimit ( 1 )
50
+ . font ( . footnote)
51
+ . foregroundColor ( . secondary)
52
+ }
51
53
Text ( text, bundle: bundle)
52
54
}
53
55
@@ -70,13 +72,18 @@ public struct ListActionRow: View {
70
72
)
71
73
72
74
ListActionRow (
73
- title: " Preview.Title. \( 2 ) " ,
74
75
text: " Preview.Text. \( 2 ) " ,
75
76
bundle: . module,
76
77
action: . copy( " " )
77
78
)
78
79
. buttonStyle ( . borderedProminent)
79
80
81
+ ListActionRow (
82
+ text: " Preview.Text. \( 2 ) Preview.Text. \( 2 ) Preview.Text. \( 2 ) Preview.Text. \( 2 ) Preview.Text. \( 2 ) Preview.Text. \( 2 ) Preview.Text. \( 2 ) " ,
83
+ bundle: . module
84
+ )
85
+ . font ( . footnote)
86
+
80
87
ListActionRow (
81
88
title: " Preview.Title. \( 3 ) " ,
82
89
text: " Preview.Text.Long " ,
0 commit comments