|
- import Combine
- import SwiftUI
-
- final class VM: ObservableObject {
-
-
-
- @Published var t3 = "a:value"
-
- var subscriptions = Set<AnyCancellable>()
-
- init() {
- $t3
- .debounce(for: .seconds(0.3), scheduler: DispatchQueue.main)
- .sink { v in
- print("ИГР VM.init t3: '\(v)'")
-
-
- guard v.hasPrefix("u:") else { return }
- Bus.send(MeetupId.Keys.meetupIdTextUI.rawValue, String(v.dropFirst(2)))
- }
- .store(in: &subscriptions)
-
- Bus.receiveAsync(
- &subscriptions,
- [MeetupId.Keys.meetupIdTextApp.rawValue],
- { [weak self] _, v in self?.applyFormattedValue(v) }
- )
-
-
-
- }
-
- func applyFormattedValue(_ value: String) {
- print("ИГР VM.handleFV value: '\(value)'")
- t3 = "a:\(value)"
- }
-
- }
|