Skip to content

Commit

Permalink
Merge branch 'main' into navigation-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencelis committed Mar 8, 2023
2 parents b46e4be + 3e8eee1 commit bfadebf
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "dd86159e25c749873f144577e5d18309bf57534f",
"version" : "0.8.0"
"revision" : "de8ba65649e7ee317b9daf27dd5eebf34bd4be57",
"version" : "0.9.1"
}
},
{
"identity" : "swift-dependencies",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-dependencies",
"state" : {
"revision" : "8282b0c59662eb38946afe30eb403663fc2ecf76",
"version" : "0.1.4"
"revision" : "6bb1034e8a1bfbf46dfb766b6c09b7b17e1cba10",
"version" : "0.2.0"
}
},
{
Expand Down Expand Up @@ -104,8 +104,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swiftui-navigation",
"state" : {
"revision" : "270a754308f5440be52fc295242eb7031638bd15",
"version" : "0.6.1"
"revision" : "0a0e1b321d70ee6a464ecfe6b0136d9eff77ebfc",
"version" : "0.7.0"
}
},
{
Expand Down
16 changes: 8 additions & 8 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-case-paths",
"state" : {
"revision" : "f623901b4bcc97f59c36704f81583f169b228e51",
"version" : "0.13.0"
"revision" : "870133b7b2387df136ad301ec67b2e864b51dda1",
"version" : "0.14.0"
}
},
{
Expand All @@ -59,17 +59,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "dd86159e25c749873f144577e5d18309bf57534f",
"version" : "0.8.0"
"revision" : "de8ba65649e7ee317b9daf27dd5eebf34bd4be57",
"version" : "0.9.1"
}
},
{
"identity" : "swift-dependencies",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-dependencies",
"state" : {
"revision" : "8282b0c59662eb38946afe30eb403663fc2ecf76",
"version" : "0.1.4"
"revision" : "6bb1034e8a1bfbf46dfb766b6c09b7b17e1cba10",
"version" : "0.2.0"
}
},
{
Expand Down Expand Up @@ -104,8 +104,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swiftui-navigation",
"state" : {
"revision" : "270a754308f5440be52fc295242eb7031638bd15",
"version" : "0.6.1"
"revision" : "0a0e1b321d70ee6a464ecfe6b0136d9eff77ebfc",
"version" : "0.7.0"
}
},
{
Expand Down
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ let package = Package(
.package(url: "https://github.com/google/swift-benchmark", from: "0.1.0"),
.package(url: "https://github.com/pointfreeco/combine-schedulers", from: "0.8.0"),
.package(url: "https://github.com/pointfreeco/swift-case-paths", from: "0.14.0"),
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "0.7.0"),
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "0.1.2"),
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "0.9.1"),
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "0.2.0"),
.package(url: "https://github.com/pointfreeco/swift-identified-collections", from: "0.7.0"),
.package(url: "https://github.com/pointfreeco/swiftui-navigation", from: "0.6.0"),
.package(url: "https://github.com/pointfreeco/swiftui-navigation", from: "0.7.0"),
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "0.5.0"),
],
targets: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

- ``EffectPublisher/unimplemented(_:)``

### Combine integration

- ``EffectPublisher/publisher(_:)``

### SwiftUI integration

- ``EffectPublisher/animation(_:)``
Expand Down
73 changes: 53 additions & 20 deletions Sources/ComposableArchitecture/Effects/Publisher.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import Combine

extension EffectPublisher where Failure == Never {
/// Creates an effect from a Combine publisher.
///
/// - Parameter createPublisher: The closure to execute when the effect is performed.
/// - Returns: An effect wrapping a Combine publisher.
public static func publisher<P: Publisher>(_ createPublisher: @escaping () -> P) -> Self
where P.Output == Action, P.Failure == Never {
Self(
operation: .publisher(Deferred(createPublisher: createPublisher).eraseToAnyPublisher())
)
}
}

@available(iOS, deprecated: 9999.0)
@available(macOS, deprecated: 9999.0)
@available(tvOS, deprecated: 9999.0)
Expand Down Expand Up @@ -79,19 +92,23 @@ extension EffectPublisher {
/// - Parameter publisher: A publisher.
@available(
iOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
@available(
macOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
@available(
tvOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
@available(
watchOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
public init<P: Publisher>(_ publisher: P) where P.Output == Output, P.Failure == Failure {
self.operation = .publisher(publisher.eraseToAnyPublisher())
Expand Down Expand Up @@ -367,19 +384,23 @@ extension Publisher {
/// - Returns: An effect that wraps `self`.
@available(
iOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
@available(
macOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
@available(
tvOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
@available(
watchOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
public func eraseToEffect() -> EffectPublisher<Output, Failure> {
EffectPublisher(self)
Expand All @@ -402,19 +423,23 @@ extension Publisher {
/// - Returns: An effect that wraps `self` after mapping `Output` values.
@available(
iOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
@available(
macOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
@available(
tvOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
@available(
watchOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
public func eraseToEffect<T>(
_ transform: @escaping (Output) -> T
Expand Down Expand Up @@ -447,19 +472,23 @@ extension Publisher {
/// - Returns: An effect that wraps `self`.
@available(
iOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
@available(
macOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
@available(
tvOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
@available(
watchOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
public func catchToEffect() -> EffectTask<Result<Output, Failure>> {
self.catchToEffect { $0 }
Expand All @@ -482,19 +511,23 @@ extension Publisher {
/// - Returns: An effect that wraps `self`.
@available(
iOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
@available(
macOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
@available(
tvOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
@available(
watchOS, deprecated: 9999.0,
message: "Iterate over 'Publisher.values' in an 'EffectTask.run', instead."
message:
"Iterate over 'Publisher.values' in an 'EffectTask.run', instead, or use 'EffectTask.publisher'."
)
public func catchToEffect<T>(
_ transform: @escaping (Result<Output, Failure>) -> T
Expand Down
2 changes: 1 addition & 1 deletion Sources/ComposableArchitecture/SwiftUI/WithViewStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import SwiftUI
/// instead of using ``WithViewStore``:
///
/// 1. When ``WithViewStore`` wraps complex views the Swift compiler can quickly become bogged down,
/// leading to degraded compiler performance and diagnostics. If you are experience such instability
/// leading to degraded compiler performance and diagnostics. If you are experiencing such instability
/// you should consider manually setting up observation with an `@ObservedObject` property as
/// described above.
///
Expand Down

0 comments on commit bfadebf

Please sign in to comment.