Skip to content

Depend on SwiftUINavigation for TextState, AlertState, etc... #1685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ let package = Package(
.package(url: "https://github.com/pointfreeco/swift-clocks", from: "0.1.4"),
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "0.6.0"),
.package(url: "https://github.com/pointfreeco/swift-identified-collections", from: "0.4.1"),
.package(url: "https://github.com/pointfreeco/swiftui-navigation", from: "0.4.1"),
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "0.5.0"),
],
targets: [
Expand All @@ -39,6 +40,7 @@ let package = Package(
.product(name: "CombineSchedulers", package: "combine-schedulers"),
.product(name: "CustomDump", package: "swift-custom-dump"),
.product(name: "IdentifiedCollections", package: "swift-identified-collections"),
.product(name: "_SwiftUINavigationState", package: "swiftui-navigation"),
.product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay"),
]
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ The Composable Architecture can be used to power applications built in many fram
- ``BindingReducer``
- ``ViewStore/binding(_:file:fileID:line:)``

### View state

- ``AlertState``
- ``ConfirmationDialogState``
- ``TextState``

<!--DocC: Can't currently document `View` extensions-->
<!--### View Modifiers-->

Expand Down
57 changes: 13 additions & 44 deletions Sources/ComposableArchitecture/Internal/Deprecations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ import Combine
import SwiftUI
import XCTestDynamicOverlay

// MARK: - Deprecated after 0.45.0:

@available(
*,
deprecated,
message: "Pass 'TextState' to the 'SwiftUI.Text' initializer, instead, e.g., 'Text(textState)'."
)
extension TextState: View {
public var body: some View {
Text(self)
}
}

// MARK: - Deprecated after 0.42.0:

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

// MARK: - Deprecated after 0.27.1:

extension AlertState.Button {
@available(
*, deprecated, message: "Cancel buttons must be given an explicit label as their first argument"
)
public static func cancel(action: AlertState.ButtonAction? = nil) -> Self {
.init(action: action, label: TextState("Cancel"), role: .cancel)
}
}

Comment on lines -847 to -855
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't compiling so I just removed since it's so old. But I can debug it if we don't want to remove yet.

@available(iOS 13, *)
@available(macOS 12, *)
@available(tvOS 13, *)
Expand Down Expand Up @@ -1039,41 +1043,6 @@ extension ViewStore {
}
}

// MARK: - Deprecated after 0.23.0:

extension AlertState.Button {
Comment on lines -1042 to -1044
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with all of this.

@available(*, deprecated, renamed: "cancel(_:action:)")
public static func cancel(
_ label: TextState,
send action: Action?
) -> Self {
.cancel(label, action: action.map(AlertState.ButtonAction.send))
}

@available(*, deprecated, renamed: "cancel(action:)")
public static func cancel(
send action: Action?
) -> Self {
.cancel(action: action.map(AlertState.ButtonAction.send))
}

@available(*, deprecated, renamed: "default(_:action:)")
public static func `default`(
_ label: TextState,
send action: Action?
) -> Self {
.default(label, action: action.map(AlertState.ButtonAction.send))
}

@available(*, deprecated, renamed: "destructive(_:action:)")
public static func destructive(
_ label: TextState,
send action: Action?
) -> Self {
.destructive(label, action: action.map(AlertState.ButtonAction.send))
}
}

// MARK: - Deprecated after 0.20.0:

extension AnyReducer {
Expand Down
1 change: 1 addition & 0 deletions Sources/ComposableArchitecture/Internal/Exports.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
@_exported import CustomDump
@_exported import Dependencies
@_exported import IdentifiedCollections
@_exported import _SwiftUINavigationState
Loading