@@ -21,7 +21,7 @@ extension Middleware where StateType: Equatable {
21
21
}
22
22
} ,
23
23
queue: DispatchQueue = . main
24
- ) -> LoggerMiddleware < Self , InputActionType , OutputActionType , StateType > {
24
+ ) -> LoggerMiddleware < Self > {
25
25
LoggerMiddleware (
26
26
self ,
27
27
actionTransform: actionTransform,
@@ -33,8 +33,10 @@ extension Middleware where StateType: Equatable {
33
33
}
34
34
}
35
35
36
- public final class LoggerMiddleware < M: Middleware , InputActionType, OutputActionType, StateType: Equatable >
37
- where M. StateType == StateType , M. InputActionType == InputActionType , M. OutputActionType == OutputActionType {
36
+ public final class LoggerMiddleware < M: Middleware > : Middleware where M. StateType: Equatable {
37
+ public typealias InputActionType = M . InputActionType
38
+ public typealias OutputActionType = M . OutputActionType
39
+ public typealias StateType = M . StateType
38
40
private let middleware : M
39
41
private let queue : DispatchQueue
40
42
private var getState : GetState < StateType > ?
@@ -83,8 +85,8 @@ where M.StateType == StateType, M.InputActionType == InputActionType, M.OutputAc
83
85
}
84
86
}
85
87
86
- extension LoggerMiddleware where M == IdentityMiddleware < InputActionType , OutputActionType , StateType > {
87
- public convenience init (
88
+ extension LoggerMiddleware {
89
+ public static func `default` (
88
90
actionTransform: @escaping ( InputActionType , ActionSource ) -> String = {
89
91
" \n 🕹 \( $0) \n 🎪 \( $1. file. split ( separator: " / " ) . last ?? " " ) : \( $1. line) \( $1. function) "
90
92
} ,
@@ -102,12 +104,14 @@ extension LoggerMiddleware where M == IdentityMiddleware<InputActionType, Output
102
104
}
103
105
} ,
104
106
queue: DispatchQueue = . main
105
- ) {
106
- self . init ( IdentityMiddleware ( ) ,
107
- actionTransform: actionTransform,
108
- actionPrinter: actionPrinter,
109
- stateDiffTransform: stateDiffTransform,
110
- stateDiffPrinter: stateDiffPrinter,
111
- queue: queue)
107
+ ) -> LoggerMiddleware < IdentityMiddleware < InputActionType , OutputActionType , StateType > > {
108
+ . init(
109
+ IdentityMiddleware ( ) ,
110
+ actionTransform: actionTransform,
111
+ actionPrinter: actionPrinter,
112
+ stateDiffTransform: stateDiffTransform,
113
+ stateDiffPrinter: stateDiffPrinter,
114
+ queue: queue
115
+ )
112
116
}
113
117
}
0 commit comments