37 lines
883 B
Swift
37 lines
883 B
Swift
import Combine
|
|
import SwiftUI
|
|
|
|
final class VM: ObservableObject {
|
|
/*
|
|
@Published var text = "a:"
|
|
let format = Bus.Processor(
|
|
MeetupId.K.meetupIdTextUI.rawValue,
|
|
MeetupId.K.meetupIdTextApp.rawValue,
|
|
MeetupId.onlyFormat
|
|
)
|
|
*/
|
|
var isJoinAvailable = false
|
|
var subscriptions = [AnyCancellable]()
|
|
|
|
init() {
|
|
/*
|
|
Bus.send(
|
|
MeetupId.K.meetupIdTextUI.rawValue,
|
|
$text
|
|
// Исключаем конфликты от UI и App путём игнорирования спама.
|
|
.debounce(for: .seconds(0.3), scheduler: DispatchQueue.main)
|
|
.compactMap(onlyUIText)
|
|
.eraseToAnyPublisher(),
|
|
sub: &subscriptions
|
|
)
|
|
|
|
Bus.receive(
|
|
[MeetupId.K.meetupIdTextApp.rawValue],
|
|
{ [weak self] (_, v: String) in self?.text = "a:\(v)" },
|
|
opt: [.async],
|
|
sub: &subscriptions
|
|
)
|
|
*/
|
|
}
|
|
}
|