Skip to content

Commit 0a19581

Browse files
Depend on SwiftUINavigation for TextState, AlertState, etc... (#1685)
* Use `swiftui-navigation` for alerts * wip * wip * wip * wip * wip Co-authored-by: Stephen Celis <[email protected]>
1 parent 52dca7e commit 0a19581

File tree

11 files changed

+65
-1305
lines changed

11 files changed

+65
-1305
lines changed

ComposableArchitecture.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.resolved

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ let package = Package(
2828
.package(url: "https://github.com/pointfreeco/swift-clocks", from: "0.1.4"),
2929
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "0.6.0"),
3030
.package(url: "https://github.com/pointfreeco/swift-identified-collections", from: "0.4.1"),
31+
.package(url: "https://github.com/pointfreeco/swiftui-navigation", from: "0.4.1"),
3132
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "0.5.0"),
3233
],
3334
targets: [
@@ -39,6 +40,7 @@ let package = Package(
3940
.product(name: "CombineSchedulers", package: "combine-schedulers"),
4041
.product(name: "CustomDump", package: "swift-custom-dump"),
4142
.product(name: "IdentifiedCollections", package: "swift-identified-collections"),
43+
.product(name: "_SwiftUINavigationState", package: "swiftui-navigation"),
4244
.product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay"),
4345
]
4446
),

Sources/ComposableArchitecture/Documentation.docc/Extensions/SwiftUI.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ The Composable Architecture can be used to power applications built in many fram
2525
- ``BindingReducer``
2626
- ``ViewStore/binding(_:file:fileID:line:)``
2727

28-
### View state
29-
30-
- ``AlertState``
31-
- ``ConfirmationDialogState``
32-
- ``TextState``
33-
3428
<!--DocC: Can't currently document `View` extensions-->
3529
<!--### View Modifiers-->
3630

Sources/ComposableArchitecture/Internal/Deprecations.swift

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ import Combine
33
import SwiftUI
44
import XCTestDynamicOverlay
55

6+
// MARK: - Deprecated after 0.45.0:
7+
8+
@available(
9+
*,
10+
deprecated,
11+
message: "Pass 'TextState' to the 'SwiftUI.Text' initializer, instead, e.g., 'Text(textState)'."
12+
)
13+
extension TextState: View {
14+
public var body: some View {
15+
Text(self)
16+
}
17+
}
18+
619
// MARK: - Deprecated after 0.42.0:
720

821
/// This API has been deprecated in favor of ``ReducerProtocol``.
@@ -844,15 +857,6 @@ extension TestStore where ScopedState: Equatable, Action: Equatable {
844857

845858
// MARK: - Deprecated after 0.27.1:
846859

847-
extension AlertState.Button {
848-
@available(
849-
*, deprecated, message: "Cancel buttons must be given an explicit label as their first argument"
850-
)
851-
public static func cancel(action: AlertState.ButtonAction? = nil) -> Self {
852-
.init(action: action, label: TextState("Cancel"), role: .cancel)
853-
}
854-
}
855-
856860
@available(iOS 13, *)
857861
@available(macOS 12, *)
858862
@available(tvOS 13, *)
@@ -1039,41 +1043,6 @@ extension ViewStore {
10391043
}
10401044
}
10411045

1042-
// MARK: - Deprecated after 0.23.0:
1043-
1044-
extension AlertState.Button {
1045-
@available(*, deprecated, renamed: "cancel(_:action:)")
1046-
public static func cancel(
1047-
_ label: TextState,
1048-
send action: Action?
1049-
) -> Self {
1050-
.cancel(label, action: action.map(AlertState.ButtonAction.send))
1051-
}
1052-
1053-
@available(*, deprecated, renamed: "cancel(action:)")
1054-
public static func cancel(
1055-
send action: Action?
1056-
) -> Self {
1057-
.cancel(action: action.map(AlertState.ButtonAction.send))
1058-
}
1059-
1060-
@available(*, deprecated, renamed: "default(_:action:)")
1061-
public static func `default`(
1062-
_ label: TextState,
1063-
send action: Action?
1064-
) -> Self {
1065-
.default(label, action: action.map(AlertState.ButtonAction.send))
1066-
}
1067-
1068-
@available(*, deprecated, renamed: "destructive(_:action:)")
1069-
public static func destructive(
1070-
_ label: TextState,
1071-
send action: Action?
1072-
) -> Self {
1073-
.destructive(label, action: action.map(AlertState.ButtonAction.send))
1074-
}
1075-
}
1076-
10771046
// MARK: - Deprecated after 0.20.0:
10781047

10791048
extension AnyReducer {

Sources/ComposableArchitecture/Internal/Exports.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
@_exported import CustomDump
55
@_exported import Dependencies
66
@_exported import IdentifiedCollections
7+
@_exported import _SwiftUINavigationState

0 commit comments

Comments
 (0)