Проверка шаблона шины для iOS
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

118 satır
2.4KB

  1. // ВНИМАНИЕ Сгенерировано автоматом из файла MeetupId.yml
  2. // ВНИМАНИЕ Не менять руками!
  3. import AELog
  4. import BusX
  5. import Combine
  6. import CordX
  7. import Foundation
  8. import MPAKX
  9. import UIKit
  10. // MARK: - Context
  11. public protocol MeetupIdContext {
  12. var textApp: MPAK.Recent<String> { get }
  13. var textUI: MPAK.Recent<String> { get }
  14. }
  15. // MARK: - Controller
  16. extension MeetupId {
  17. final class Controller: MPAK.Controller<MeetupId.Model> {
  18. init() {
  19. super.init(
  20. MeetupId.Model(),
  21. debugClassName: "MeetupICtrl",
  22. debugLog: { aelog($0) }
  23. )
  24. }
  25. }
  26. // MARK: - Model
  27. public struct Model: MeetupIdContext {
  28. public var textApp: MPAK.Recent<String> = .init("")
  29. public var textUI: MPAK.Recent<String> = .init("")
  30. }
  31. // MARK: - Service
  32. public final class Service {
  33. let ctrl = Controller()
  34. let world: World
  35. var subscriptions = [AnyCancellable]()
  36. static private(set) weak var singleton: Service?
  37. public init(_ world: World) {
  38. self.world = world
  39. Self.singleton = self
  40. SectionGenerated.setupPlatform(ctrl, self, world)
  41. }
  42. }
  43. // MARK: - World
  44. public struct World {
  45. let textApp = PassthroughSubject<String, Never>()
  46. let textUI = PassthroughSubject<String, Never>()
  47. public init(
  48. ) {
  49. }
  50. }
  51. enum SectionGenerated {
  52. // MARK: - SectionGenerated Service
  53. static func setupPlatform(
  54. _ ctrl: Controller,
  55. _ service: Service,
  56. _ world: World
  57. ) {
  58. // MARK: - SectionGenerated Service Actions
  59. // MARK: - SectionGenerated Service Pipes
  60. ctrl.pipeValue(
  61. dbg: "textA",
  62. sub: nil,
  63. Bus.events.compactMap { Bus.convertKeyValue(K.meetupIdTextApp.rawValue, $0) }.map { (k: String, v: String) in v }.eraseToAnyPublisher().eraseToAnyPublisher(),
  64. {
  65. $0.textApp.value = $1
  66. $0.textApp.isRecent = true
  67. },
  68. { m, _ in m.textApp.isRecent = false }
  69. )
  70. ctrl.pipeValue(
  71. dbg: "textUI",
  72. sub: nil,
  73. Bus.events.compactMap { Bus.convertKeyValue(K.meetupIdTextUI.rawValue, $0) }.map { (k: String, v: String) in v }.eraseToAnyPublisher().eraseToAnyPublisher(),
  74. {
  75. $0.textUI.value = $1
  76. $0.textUI.isRecent = true
  77. },
  78. { m, _ in m.textUI.isRecent = false }
  79. )
  80. }
  81. }
  82. }