Проверка шаблона шины для 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.

30 lines
584B

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