Esse commit está contido em:
Михаил Капелько
2023-12-26 12:54:38 +03:00
commit 19e4b7cd52
3 arquivos alterados com 31 adições e 1 exclusões

15
src/Bus.Receiver.swift Arquivo normal
Ver arquivo

@@ -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
src/Bus.Sender.swift Arquivo normal
Ver arquivo

@@ -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)
}
}
}

Ver arquivo

@@ -7,7 +7,7 @@ final class VM: ObservableObject {
var subscriptions = [AnyCancellable]()
init() {
Bus.send(
Bus.send(
MeetupId.K.meetupIdTextUI.rawValue,
$text
// Исключаем конфликты от UI и App путём игнорирования спама.