From 34a63c92b3f5e360ab0058c8766f95d81c002c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Tue, 26 Dec 2023 12:58:01 +0300 Subject: [PATCH] d --- src/Bus.Processor.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/Bus.Processor.swift diff --git a/src/Bus.Processor.swift b/src/Bus.Processor.swift new file mode 100644 index 0000000..edf967e --- /dev/null +++ b/src/Bus.Processor.swift @@ -0,0 +1,16 @@ +import Combine + +public extension Bus { + final class Processor { + var subscriptions = [AnyCancellable]() + + public init( + _ keyIn: String, + _ keyOut: String, + _ handler: @escaping ((Src) -> Dst?), + opt: [Option] = [] + ) { + Bus.process(keyIn, keyOut, handler, opt: opt, sub: &subscriptions) + } + } +}