Михаил Капелько 10 个月前
父节点
当前提交
19e4b7cd52
共有 3 个文件被更改,包括 31 次插入1 次删除
  1. +15
    -0
      src/Bus.Receiver.swift
  2. +15
    -0
      src/Bus.Sender.swift
  3. +1
    -1
      src/VM.swift

+ 15
- 0
src/Bus.Receiver.swift 查看文件

@@ -0,0 +1,15 @@
import Combine

public extension Bus {
final class Receiver<T> {
var subscriptions = [AnyCancellable]()

public init(
_ keys: Set<String>,
_ handler: @escaping ((String, T) -> Void),
opt: [Option] = [],
{
Bus.receive(keys, handler, opt: opt, sub: &subscriptions)
}
}
}

+ 15
- 0
src/Bus.Sender.swift 查看文件

@@ -0,0 +1,15 @@
import Combine

public extension Bus {
final class Sender<T> {
var subscriptions = [AnyCancellable]()

public init(
_ key: String,
_ node: AnyPublisher<T, Never>,
opt: [Option] = []
) {
Bus.send(key, node, opt: opt, sub: &subscriptions)
}
}
}

+ 1
- 1
src/VM.swift 查看文件

@@ -7,7 +7,7 @@ final class VM: ObservableObject {
var subscriptions = [AnyCancellable]()

init() {
Bus.send(
Bus.send(
MeetupId.K.meetupIdTextUI.rawValue,
$text
// Исключаем конфликты от UI и App путём игнорирования спама.


正在加载...
取消
保存