From fb6b5cba248d395671c7cee9f32883c50db3867a 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: Sat, 16 Dec 2023 11:05:22 +0300 Subject: [PATCH] d --- src/Bus.swift | 10 +++++++--- src/MeetupId.swift | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Bus.swift b/src/Bus.swift index b61cad6..19bc2da 100644 --- a/src/Bus.swift +++ b/src/Bus.swift @@ -90,16 +90,20 @@ public extension Bus { } public extension Bus { - static func registerProcessing( + static func processSync( _ subscriptions: inout Set, _ keyIn: String, _ keyOut: String, _ handler: @escaping ((Src) -> Dst?) ) { Service.singleton?.broadcaster - .filter { $0.key == keyIn } .compactMap { - guard let vIn = $0.value as? Src else { return nil } + guard + $0.key == keyIn, + let vIn = $0.value as? Src + else { + return nil + } return handler(vIn) } .sink { vOut in Service.singleton?.send(keyOut, vOut) } diff --git a/src/MeetupId.swift b/src/MeetupId.swift index 99df8ea..5435b8a 100644 --- a/src/MeetupId.swift +++ b/src/MeetupId.swift @@ -32,11 +32,11 @@ enum MeetupId { } init() { - Bus.registerProcessing( + Bus.processSync( &subscriptions, Keys.meetupIdTextUI.rawValue, Keys.meetupIdTextApp.rawValue, - MeetupId.shouldFormat + shouldFormat ) /**/print("ИГР MeetupIF.init") }