@@ -21,7 +21,7 @@ extension Middleware where StateType: Equatable {
2121 }
2222 } ,
2323 queue: DispatchQueue = . main
24- ) -> LoggerMiddleware < Self , InputActionType , OutputActionType , StateType > {
24+ ) -> LoggerMiddleware < Self > {
2525 LoggerMiddleware (
2626 self ,
2727 actionTransform: actionTransform,
@@ -33,8 +33,10 @@ extension Middleware where StateType: Equatable {
3333 }
3434}
3535
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
3840 private let middleware : M
3941 private let queue : DispatchQueue
4042 private var getState : GetState < StateType > ?
@@ -83,8 +85,8 @@ where M.StateType == StateType, M.InputActionType == InputActionType, M.OutputAc
8385 }
8486}
8587
86- extension LoggerMiddleware where M == IdentityMiddleware < InputActionType , OutputActionType , StateType > {
87- public convenience init (
88+ extension LoggerMiddleware {
89+ public static func `default` (
8890 actionTransform: @escaping ( InputActionType , ActionSource ) -> String = {
8991 " \n 🕹 \( $0) \n 🎪 \( $1. file. split ( separator: " / " ) . last ?? " " ) : \( $1. line) \( $1. function) "
9092 } ,
@@ -102,12 +104,14 @@ extension LoggerMiddleware where M == IdentityMiddleware<InputActionType, Output
102104 }
103105 } ,
104106 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+ )
112116 }
113117}
0 commit comments