Skip to content

Commit 3bcd5ae

Browse files
committed
Make list action row title optional
1 parent ae94a47 commit 3bcd5ae

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

RELEASE_NOTES.md

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ SwiftUIKit makes its best effort to honor semver, but breaking changes can occur
44

55

66

7+
## 5.1.5
8+
9+
### 💡 Adjustment
10+
11+
* `ListActionRow` now has an optional title.
12+
13+
14+
715
## 5.1.4
816

917
### ✨ Features

Sources/SwiftUIKit/Lists/ListActionRow.swift

+16-9
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,36 @@ public struct ListActionRow: View {
2020
/// Create a list action row with a custom trailing view.
2121
///
2222
/// - Parameters:
23-
/// - title: The row title.
23+
/// - title: The row title, if any.
2424
/// - text: The row text.
2525
/// - action: The ``ListAction`` to use.
2626
/// - trailingView: An optional trailing view to apply to the view.
2727
public init(
28-
title: LocalizedStringKey,
28+
title: LocalizedStringKey? = nil,
2929
text: LocalizedStringKey,
3030
bundle: Bundle? = nil,
31-
action: ListAction?
31+
action: ListAction? = nil
3232
) {
3333
self.title = title
3434
self.text = text
3535
self.bundle = bundle
3636
self.action = action
3737
}
3838

39-
private let title: LocalizedStringKey
39+
private let title: LocalizedStringKey?
4040
private let text: LocalizedStringKey
4141
private let bundle: Bundle?
4242
private let action: ListAction?
4343

4444
public var body: some View {
4545
HStack(spacing: 10) {
4646
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+
}
5153
Text(text, bundle: bundle)
5254
}
5355

@@ -70,13 +72,18 @@ public struct ListActionRow: View {
7072
)
7173

7274
ListActionRow(
73-
title: "Preview.Title.\(2)",
7475
text: "Preview.Text.\(2)",
7576
bundle: .module,
7677
action: .copy("")
7778
)
7879
.buttonStyle(.borderedProminent)
7980

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+
8087
ListActionRow(
8188
title: "Preview.Title.\(3)",
8289
text: "Preview.Text.Long",

0 commit comments

Comments
 (0)