1717import Foundation
1818import RxSwift
1919
20- public extension PrimitiveSequenceType where Self: StoreType & ObservableType , Self. Trait == SingleTrait {
20+ public extension PrimitiveSequenceType where Self: ObservableConvertibleType , Self. Trait == SingleTrait {
2121
2222 func dispatch< A: CompletableAction > ( action: A . Type ,
2323 expiration: Task . Expiration = . immediately,
@@ -27,11 +27,13 @@ public extension PrimitiveSequenceType where Self: StoreType & ObservableType, S
2727 -> Disposable where A. Payload == Self . Element {
2828 let subscription = self . subscribe (
2929 onSuccess: { payload in
30- let action = A ( task: . requestSuccess( expiration) , payload: payload)
30+ // swiftlint:disable:next explicit_init
31+ let action = A . init ( task: . requestSuccess( expiration) , payload: payload)
3132 dispatcher. dispatch ( action, mode: mode)
3233 } ,
3334 onError: { error in
34- let action = A ( task: . requestFailure( error) , payload: errorPayload)
35+ // swiftlint:disable:next explicit_init
36+ let action = A . init ( task: . requestFailure( error) , payload: errorPayload)
3537 dispatcher. dispatch ( action, mode: mode)
3638 }
3739 )
@@ -47,11 +49,13 @@ public extension PrimitiveSequenceType where Self: StoreType & ObservableType, S
4749 -> Disposable where A. Payload == Self . Element {
4850 let subscription = self . subscribe (
4951 onSuccess: { payload in
50- let action = A ( task: . requestSuccess( expiration) , payload: payload, key: key)
52+ // swiftlint:disable:next explicit_init
53+ let action = A . init ( task: . requestSuccess( expiration) , payload: payload, key: key)
5154 dispatcher. dispatch ( action, mode: mode)
5255 } ,
5356 onError: { error in
54- let action = A ( task: . requestFailure( error) , payload: errorPayload, key: key)
57+ // swiftlint:disable:next explicit_init
58+ let action = A . init ( task: . requestFailure( error) , payload: errorPayload, key: key)
5559 dispatcher. dispatch ( action, mode: mode)
5660 }
5761 )
@@ -65,11 +69,13 @@ public extension PrimitiveSequenceType where Self: StoreType & ObservableType, S
6569 return Single . create { single in
6670 let subscription = self . subscribe (
6771 onSuccess: { payload in
68- let action = A ( task: . requestSuccess( expiration) , payload: payload)
72+ // swiftlint:disable:next explicit_init
73+ let action = A . init ( task: . requestSuccess( expiration) , payload: payload)
6974 single ( . success( action) )
7075 } ,
7176 onError: { error in
72- let action = A ( task: . requestFailure( error) , payload: errorPayload)
77+ // swiftlint:disable:next explicit_init
78+ let action = A . init ( task: . requestFailure( error) , payload: errorPayload)
7379 single ( . success( action) )
7480 }
7581 )
@@ -88,10 +94,12 @@ public extension PrimitiveSequenceType where Trait == CompletableTrait, Element
8894 let subscription = self . subscribe { completable in
8995 switch completable {
9096 case . completed:
91- let action = A ( task: . requestSuccess( expiration) )
97+ // swiftlint:disable:next explicit_init
98+ let action = A . init ( task: . requestSuccess( expiration) )
9299 dispatcher. dispatch ( action, mode: mode)
93100 case . error( let error) :
94- let action = A ( task: . requestFailure( error) )
101+ // swiftlint:disable:next explicit_init
102+ let action = A . init ( task: . requestFailure( error) )
95103 dispatcher. dispatch ( action, mode: mode)
96104 }
97105 }
0 commit comments