File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -338,7 +338,7 @@ extension InterceptionHandlerProtocol {
338338public struct SimpleInterceptionHandler : InterceptionHandlerProtocol {
339339 private var _action : ( InterceptionResult < Any , Any > ) -> Void
340340
341- init ( _ action: @escaping ( InterceptionResult < Any , Any > ) -> Void ) {
341+ public init ( _ action: @escaping ( InterceptionResult < Any , Any > ) -> Void ) {
342342 self . _action = action
343343 }
344344
@@ -352,8 +352,14 @@ public struct SimpleInterceptionHandler: InterceptionHandlerProtocol {
352352public final class InterceptionHandlers {
353353 private var storage : [ AnyHashable : InterceptionHandlerProtocol ] = [ : ]
354354
355- public func register( _ action: InterceptionHandlerProtocol ? , for key: AnyHashable ) {
356- storage [ key] = action
355+ public subscript( key: AnyHashable ) -> InterceptionHandlerProtocol ? {
356+ set { self . storage [ key] = newValue }
357+ _read { yield self . storage [ key] }
358+ _modify { yield & self . storage [ key] }
359+ }
360+
361+ public func register( _ handler: InterceptionHandlerProtocol ? , for key: AnyHashable ) {
362+ storage [ key] = handler
357363 }
358364
359365 public func callAsFunction( _ invocation: AnyObject ) {
You can’t perform that action at this time.
0 commit comments