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

MeetupId.Generated.swift 2.4KB

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. }