Проверка шаблона шины для iOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
553B

  1. import BusX
  2. import Combine
  3. import SwiftUI
  4. extension Cord {
  5. final class TextField: ObservableObject {
  6. @Published var value = "a:"
  7. var subscriptions = [AnyCancellable]()
  8. init(
  9. _ textApp: String,
  10. _ textUI: String
  11. ) {
  12. Bus.send(
  13. textUI,
  14. $value.removeDuplicates().compactMap(onlyUIText).eraseToAnyPublisher(),
  15. sub: &subscriptions
  16. )
  17. Bus.receive(
  18. [textApp],
  19. { [weak self] (_, v: String) in self?.value = "a:\(v)" },
  20. sub: &subscriptions
  21. )
  22. }
  23. }
  24. }