diff --git a/MobiusCore/Source/EffectHandlers/EnumRoute.swift b/MobiusCore/Source/EffectHandlers/EnumRoute.swift index df3d4995..8d22f885 100644 --- a/MobiusCore/Source/EffectHandlers/EnumRoute.swift +++ b/MobiusCore/Source/EffectHandlers/EnumRoute.swift @@ -19,9 +19,14 @@ public extension EffectRouter { _ enumCase: @escaping (EffectParameters) -> Effect ) -> _PartialEffectRouter { let casePath = /enumCase - return routeEffects(withParameters: { effect in - casePath.extract(from: effect) - }) + return routeEffects(withParameters: casePath.extract) + } + + func routeCase( + _ enumCase: Effect + ) -> _PartialEffectRouter { + let casePath = /enumCase + return routeEffects(withParameters: casePath.extract) } } @@ -29,12 +34,6 @@ public extension EffectRouter where Effect: Equatable { func routeCase( _ enumCase: Effect ) -> _PartialEffectRouter { - return routeEffects(withParameters: { effect in - if enumCase == effect { - return () - } else { - return nil - } - }) + return routeEffects(withParameters: { effect in effect == enumCase ? () : nil }) } } diff --git a/MobiusCore/Test/EffectHandlers/EnumRouteTests.swift b/MobiusCore/Test/EffectHandlers/EnumRouteTests.swift index aa882efc..61be83b7 100644 --- a/MobiusCore/Test/EffectHandlers/EnumRouteTests.swift +++ b/MobiusCore/Test/EffectHandlers/EnumRouteTests.swift @@ -20,7 +20,7 @@ import Quick private typealias Event = () -private enum Effect: Equatable { +private enum Effect { case justEffect case effectWithString(String) case effectWithTuple(left: String, right: Int)