d
This commit is contained in:
15
src/Bus.Receiver.swift
Normal file
15
src/Bus.Receiver.swift
Normal file
@@ -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
Normal file
15
src/Bus.Sender.swift
Normal file
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ final class VM: ObservableObject {
|
|||||||
var subscriptions = [AnyCancellable]()
|
var subscriptions = [AnyCancellable]()
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
Bus.send(
|
Bus.send(
|
||||||
MeetupId.K.meetupIdTextUI.rawValue,
|
MeetupId.K.meetupIdTextUI.rawValue,
|
||||||
$text
|
$text
|
||||||
// Исключаем конфликты от UI и App путём игнорирования спама.
|
// Исключаем конфликты от UI и App путём игнорирования спама.
|
||||||
|
|||||||
Reference in New Issue
Block a user