From 7a491bbe058ec076568832ba3333b5e603a26050 Mon Sep 17 00:00:00 2001 From: Oliver Foggin Date: Thu, 14 Dec 2023 21:16:55 +0000 Subject: [PATCH] Removed unneeded generic --- .../SubscriberReducer.swift | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Sources/ComposableSubscriber/SubscriberReducer.swift b/Sources/ComposableSubscriber/SubscriberReducer.swift index d91262c..00db96b 100644 --- a/Sources/ComposableSubscriber/SubscriberReducer.swift +++ b/Sources/ComposableSubscriber/SubscriberReducer.swift @@ -2,20 +2,6 @@ import ComposableArchitecture import SwiftUI extension Reducer { - public func subscribe( - to stream: @escaping @Sendable () async -> AsyncStream, - on triggerAction: CaseKeyPath, - operation: @escaping @Sendable (_ send: Send, StreamElement) async throws -> Void - ) -> _SubscribeReducer { - .init( - parent: self, - on: triggerAction, - to: stream, - with: .operation(f: operation), - transform: { $0 } - ) - } - public func subscribe( to stream: @escaping @Sendable () async -> AsyncStream, on triggerAction: CaseKeyPath, @@ -46,10 +32,24 @@ extension Reducer { transform: transform ) } + + public func subscribe( + to stream: @escaping @Sendable () async -> AsyncStream, + on triggerAction: CaseKeyPath, + operation: @escaping @Sendable (_ send: Send, StreamElement) async throws -> Void + ) -> _SubscribeReducer { + .init( + parent: self, + on: triggerAction, + to: stream, + with: .operation(f: operation), + transform: { $0 } + ) + } } @usableFromInline -enum Operation { +enum Operation { case action(action: AnyCasePath, animation: Animation?) case operation(f: (_ send: Send, Value) async throws -> Void) } @@ -65,7 +65,7 @@ public struct _SubscribeReducer AsyncStream @usableFromInline - let operation: Operation + let operation: Operation @usableFromInline let transform: (StreamElement) -> Value @@ -74,7 +74,7 @@ public struct _SubscribeReducer, to stream: @escaping @Sendable () async -> AsyncStream, - with operation: Operation, + with operation: Operation, transform: @escaping @Sendable (StreamElement) -> Value ) { self.parent = parent