Skip to content

Commit 35964d0

Browse files
committed
Deprecate list actions
1 parent 98ba01e commit 35964d0

File tree

5 files changed

+31
-53
lines changed

5 files changed

+31
-53
lines changed

RELEASE_NOTES.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@ SwiftUIKit makes its best effort to honor semver, but breaking changes can occur
44

55

66

7+
## 5.8.3
8+
9+
This version deprecates list action types.
10+
11+
### 💡 Adjustment
12+
13+
* `ListAction` has been adjusted to compile in Xcode 26.
14+
15+
### 🗑️ Deprecations
16+
17+
* `ListAction` has been moved to https://github.com/danielsaidi/StandardButtons.
18+
* `ListActionRow` has been deprecated.
19+
20+
21+
722
## 5.8.2
823

924
This version disables Swift package flags for framework usage.

Sources/SwiftUIKit/SwiftUIKit.docc/SwiftUIKit.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ SwiftUIKit is available under the MIT license.
9797

9898
### Lists
9999

100-
- ``ListAction``
101-
- ``ListActionRow``
102100
- ``ListButtonGroup``
103101
- ``ListButtonGroupStyle``
104102
- ``ListButtonStyle``

Sources/SwiftUIKit/_Deprecated/ButtonType.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import SwiftUI
1010

11-
@available(*, deprecated, message: "ButtonType has been moved to https://github.com/danielsaidi/ButtonKit")
11+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/StandardButtons")
1212
public extension Button {
1313

1414
/// Create a new ``ButtonType``-based button.
@@ -39,7 +39,7 @@ public extension Button {
3939
}
4040
}
4141

42-
@available(*, deprecated, message: "ButtonType has been moved to https://github.com/danielsaidi/ButtonKit")
42+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/StandardButtons")
4343
public enum ButtonType: String, CaseIterable, Identifiable {
4444
case add, addToFavorites,
4545
cancel, call, close, copy,
@@ -52,7 +52,7 @@ public enum ButtonType: String, CaseIterable, Identifiable {
5252
save, search, select, share
5353
}
5454

55-
@available(*, deprecated, message: "ButtonType has been moved to https://github.com/danielsaidi/ButtonKit")
55+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/StandardButtons")
5656
public extension ButtonType {
5757

5858
static func toggleFavorite(isFavorite: Bool) -> ButtonType {
@@ -150,7 +150,7 @@ public extension ButtonType {
150150
}
151151
}
152152

153-
@available(*, deprecated, message: "ButtonType has been moved to https://github.com/danielsaidi/ButtonKit")
153+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/StandardButtons")
154154
public extension View {
155155

156156
@ViewBuilder

Sources/SwiftUIKit/Lists/ListAction.swift renamed to Sources/SwiftUIKit/_Deprecated/ListAction.swift

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
import SwiftUI
99

10-
/// This enum defines actions that can be triggered within a
11-
/// form or a list.
10+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/StandardButtons")
1211
public enum ListAction {
1312

1413
/// Call a phone number.
@@ -27,6 +26,8 @@ public enum ListAction {
2726
case openUrl(_ url: String)
2827
}
2928

29+
@MainActor
30+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/StandardButtons")
3031
public extension ListAction {
3132

3233
var accessibilityLabel: String {
@@ -51,7 +52,7 @@ public extension ListAction {
5152
@ViewBuilder content: @escaping () -> Content
5253
) -> some View {
5354
switch self {
54-
case .call(let url): link(for: calllUrl(for: url), content)
55+
case .call(let url): link(for: callUrl(for: url), content)
5556
case .copy(let text): button({ copy(text) }, content: content)
5657
case .copyImage(let img): button({ copy(img) }, content: content)
5758
case .email(let addr): link(for: emailUrl(for: addr), content)
@@ -69,22 +70,21 @@ public extension ListAction {
6970
}
7071
}
7172

73+
@MainActor
74+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/StandardButtons")
7275
private extension ListAction {
7376

7477
func emailUrl(for url: String) -> URL? {
7578
.init(string: "mailto:\(url)")
7679
}
7780

78-
func calllUrl(for url: String) -> URL? {
81+
func callUrl(for url: String) -> URL? {
7982
.init(string: "tel:\(url)")
8083
}
8184

8285
func url(for url: String) -> URL? {
8386
.init(string: url)
8487
}
85-
}
86-
87-
private extension ListAction {
8888

8989
func button<Content: View>(
9090
_ action: @escaping () -> Void,
@@ -109,6 +109,8 @@ private extension ListAction {
109109
}
110110
}
111111

112+
@MainActor
113+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/StandardButtons")
112114
private extension ListAction {
113115

114116
func copy(_ value: String) {
@@ -132,7 +134,8 @@ private extension ListAction {
132134
}
133135

134136
#Preview {
135-
137+
138+
@MainActor
136139
func view(for action: ListAction) -> some View {
137140
action.button
138141
}

Sources/SwiftUIKit/Lists/ListActionRow.swift renamed to Sources/SwiftUIKit/_Deprecated/ListActionRow.swift

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import SwiftUI
1111

1212
/// This view can be used to present action rows in a `List`.
13+
@available(*, deprecated, message: "This has been moved to https://github.com/danielsaidi/StandardButtons")
1314
public struct ListActionRow: View {
1415

1516
/// Create a list action row with a custom trailing view.
@@ -55,43 +56,4 @@ public struct ListActionRow: View {
5556
}
5657
}
5758
}
58-
59-
#Preview {
60-
61-
List {
62-
ListActionRow(
63-
title: "Preview.Title.\(1)",
64-
text: "Preview.Text.\(1)",
65-
bundle: .module,
66-
action: .call(phoneNumber: "1234")
67-
)
68-
69-
ListActionRow(
70-
text: "Preview.Text.\(2)",
71-
bundle: .module,
72-
action: .copy("")
73-
)
74-
.buttonStyle(.borderedProminent)
75-
76-
ListActionRow(
77-
text: "Preview.Text.\(2) Preview.Text.\(2) Preview.Text.\(2) Preview.Text.\(2) Preview.Text.\(2) Preview.Text.\(2) Preview.Text.\(2) ",
78-
bundle: .module,
79-
action: .email(address: "")
80-
)
81-
82-
ListActionRow(
83-
title: "Preview.Title.\(3)",
84-
text: "Preview.Text.Long",
85-
bundle: .module,
86-
action: .email(address: "")
87-
)
88-
89-
ListActionRow(
90-
title: "Preview.Title.\(4)",
91-
text: "Preview.Text.\(4)",
92-
bundle: .module,
93-
action: nil
94-
)
95-
}
96-
}
9759
#endif

0 commit comments

Comments
 (0)