Skip to content
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.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let package = Package(
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.4.0"),
.package(url: "https://github.com/pointfreeco/swift-identified-collections", from: "1.1.0"),
.package(url: "https://github.com/pointfreeco/swift-macro-testing", from: "0.2.0"),
.package(url: "https://github.com/pointfreeco/swift-navigation", from: "2.2.2"),
.package(url: "https://github.com/pointfreeco/swift-navigation", from: "2.3.0"),
.package(url: "https://github.com/pointfreeco/swift-perception", from: "1.3.4"),
.package(url: "https://github.com/pointfreeco/swift-sharing", "0.1.2"..<"3.0.0"),
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.3.0"),
Expand Down
2 changes: 1 addition & 1 deletion [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let package = Package(
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.4.0"),
.package(url: "https://github.com/pointfreeco/swift-identified-collections", from: "1.1.0"),
.package(url: "https://github.com/pointfreeco/swift-macro-testing", from: "0.2.0"),
.package(url: "https://github.com/pointfreeco/swift-navigation", from: "2.2.2"),
.package(url: "https://github.com/pointfreeco/swift-navigation", from: "2.3.0"),
.package(url: "https://github.com/pointfreeco/swift-perception", from: "1.3.4"),
.package(url: "https://github.com/pointfreeco/swift-sharing", "0.1.2"..<"3.0.0"),
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.3.0"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ integrate into application code written in UIKit.

### Presenting alerts and action sheets

- ``UIKit/UIAlertController/init(store:)``
- ``UIKit/UIAlertController``

### Stack-based navigation

- ``UIKitNavigation/NavigationStackController``
- ``UIKitNavigation/UIPushAction``

### Combine integration

Expand Down
34 changes: 14 additions & 20 deletions Sources/ComposableArchitecture/TestStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -729,30 +729,24 @@ public final class TestStore<State: Equatable, Action> {
line: UInt,
column: UInt
) {
// NB: This existential opening can go away if we can constrain 'State: Equatable' at the
// 'TestStore' level, but for some reason this breaks DocC.
if self.sharedChangeTracker.hasChanges, let stateType = State.self as? any Equatable.Type {
func open<EquatableState: Equatable>(_: EquatableState.Type) {
let store = self as! TestStore<EquatableState, Action>
try? store.expectedStateShouldMatch(
preamble: "Test store finished before asserting against changes to shared state",
postamble: """
if sharedChangeTracker.hasChanges {
try? expectedStateShouldMatch(
preamble: "Test store finished before asserting against changes to shared state",
postamble: """
Invoke "TestStore.assert" at the end of this test to assert against changes to shared \
state.
""",
expected: store.state,
actual: store.state,
updateStateToExpectedResult: nil,
skipUnnecessaryModifyFailure: true,
fileID: fileID,
filePath: filePath,
line: line,
column: column
)
}
open(stateType)
self.sharedChangeTracker.reset()
expected: state,
actual: state,
updateStateToExpectedResult: nil,
skipUnnecessaryModifyFailure: true,
fileID: fileID,
filePath: filePath,
line: line,
column: column
)
}
sharedChangeTracker.reset()
}

/// Overrides the store's dependencies for a given operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import UIKit

extension NavigationStackController {

/// Drives a navigation stack controller with a store.
///
/// See the dedicated article on <doc:Navigation> for more information on the library's
Expand Down Expand Up @@ -69,4 +68,36 @@
}
}
}

@available(iOS 17, macOS 14, tvOS 17, watchOS 10, *)
@MainActor
extension UIPushAction {
/// Pushes an element of ``StackState`` onto the current navigation stack.
///
/// This is the UIKit equivalent of
/// ``SwiftUI/NavigationLink/init(state:label:fileID:filePath:line:column:)``.
///
/// - Parameters:
/// - state: An element of stack state.
/// - fileID: The source `#fileID` associated with the push.
/// - filePath: The source `#filePath` associated with the push.
/// - line: The source `#line` associated with the push.
/// - column: The source `#column` associated with the push.
public func callAsFunction<Element: Hashable>(
state: Element,
fileID: StaticString = #fileID,
filePath: StaticString = #filePath,
line: UInt = #line,
column: UInt = #column
) {
@Dependency(\.stackElementID) var stackElementID
self(
value: StackState.Component(id: stackElementID(), element: state),
fileID: fileID,
filePath: filePath,
line: line,
column: column
)
}
}
#endif
Loading