d
This commit is contained in:
@@ -90,16 +90,20 @@ public extension Bus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public extension Bus {
|
public extension Bus {
|
||||||
static func registerProcessing<Src, Dst>(
|
static func processSync<Src, Dst>(
|
||||||
_ subscriptions: inout Set<AnyCancellable>,
|
_ subscriptions: inout Set<AnyCancellable>,
|
||||||
_ keyIn: String,
|
_ keyIn: String,
|
||||||
_ keyOut: String,
|
_ keyOut: String,
|
||||||
_ handler: @escaping ((Src) -> Dst?)
|
_ handler: @escaping ((Src) -> Dst?)
|
||||||
) {
|
) {
|
||||||
Service.singleton?.broadcaster
|
Service.singleton?.broadcaster
|
||||||
.filter { $0.key == keyIn }
|
|
||||||
.compactMap {
|
.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)
|
return handler(vIn)
|
||||||
}
|
}
|
||||||
.sink { vOut in Service.singleton?.send(keyOut, vOut) }
|
.sink { vOut in Service.singleton?.send(keyOut, vOut) }
|
||||||
|
|||||||
@@ -32,11 +32,11 @@ enum MeetupId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
Bus.registerProcessing(
|
Bus.processSync(
|
||||||
&subscriptions,
|
&subscriptions,
|
||||||
Keys.meetupIdTextUI.rawValue,
|
Keys.meetupIdTextUI.rawValue,
|
||||||
Keys.meetupIdTextApp.rawValue,
|
Keys.meetupIdTextApp.rawValue,
|
||||||
MeetupId.shouldFormat
|
shouldFormat
|
||||||
)
|
)
|
||||||
/**/print("ИГР MeetupIF.init")
|
/**/print("ИГР MeetupIF.init")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user