Михаил Капелько 11 月之前
父節點
當前提交
fb6b5cba24
共有 2 個文件被更改,包括 9 次插入5 次删除
  1. +7
    -3
      src/Bus.swift
  2. +2
    -2
      src/MeetupId.swift

+ 7
- 3
src/Bus.swift 查看文件

@@ -90,16 +90,20 @@ public extension Bus {
}

public extension Bus {
static func registerProcessing<Src, Dst>(
static func processSync<Src, Dst>(
_ subscriptions: inout Set<AnyCancellable>,
_ 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) }


+ 2
- 2
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")
}


Loading…
取消
儲存