|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- // ВНИМАНИЕ Сгенерировано автоматом из файла MeetupId.yml
- // ВНИМАНИЕ Не менять руками!
-
- import AELog
- import BusX
- import Combine
- import Foundation
- import MPAKX
- import UIKit
-
- // MARK: - Context
-
- public protocol MeetupIdContext {
- var finishLoading: Bool { get }
- var isLoading: MPAK.Recent<Bool> { get }
- var join: Bool { get }
- var textUI: MPAK.Recent<String> { get }
- }
-
- // MARK: - Controller
-
- extension MeetupId {
- final class Controller: MPAK.Controller<MeetupId.Model> {
- init() {
- super.init(
- MeetupId.Model(),
- debugClassName: "MeetupICtrl",
- debugLog: { aelog($0) }
- )
- }
- }
-
-
-
- // MARK: - Model
-
- public struct Model: MeetupIdContext {
- public var finishLoading: Bool = false
- public var isLoading: MPAK.Recent<Bool> = .init(false)
- public var join: Bool = false
- public var textUI: MPAK.Recent<String> = .init("")
- }
-
- // MARK: - Service
-
- public final class Service {
- let ctrl = Controller()
- let world: World
-
- var subscriptions = [AnyCancellable]()
- static private(set) weak var singleton: Service?
-
- public init(_ world: World) {
- self.world = world
- Self.singleton = self
- SectionGenerated.setupPlatform(ctrl, self, world)
- }
- }
-
- // MARK: - World
-
- public struct World {
-
-
- public init(
-
- ) {
-
- }
- }
-
- enum SectionGenerated {
-
-
-
- // MARK: - SectionGenerated Service
-
- static func setupPlatform(
- _ ctrl: Controller,
- _ service: Service,
- _ world: World
- ) {
- // MARK: - SectionGenerated Service Actions
-
- ctrl.m
- .sink { v in Bus.send("MeetupId", v) }
- .store(in: &service.subscriptions)
-
-
- // MARK: - SectionGenerated Service Pipes
-
- ctrl.pipe(
- dbg: "finishL",
- sub: nil,
- Bus.events.compactMap { Bus.convertKeyValue(K.finishLoading, $0) }.map { (k: String, v: Bool) in v }.eraseToAnyPublisher(),
- { $0.finishLoading = true },
- { $0.finishLoading = false }
- )
-
-
-
-
-
-
- ctrl.pipeValue(
- dbg: "isL",
- sub: nil,
- Bus.events.compactMap { Bus.convertKeyValue(K.isLoading, $0) }.map { (k: String, v: Bool) in v }.eraseToAnyPublisher(),
- {
- $0.isLoading.value = $1
- $0.isLoading.isRecent = true
- },
- { m, _ in m.isLoading.isRecent = false }
- )
-
-
-
- ctrl.pipe(
- dbg: "join",
- sub: nil,
- Bus.events.compactMap { Bus.convertKeyValue(K.join, $0) }.map { (k: String, v: Bool) in v }.eraseToAnyPublisher(),
- { $0.join = true },
- { $0.join = false }
- )
-
-
-
-
-
-
- ctrl.pipeValue(
- dbg: "textUI",
- sub: nil,
- Bus.events.compactMap { Bus.convertKeyValue(K.textUI, $0) }.map { (k: String, v: String) in v }.eraseToAnyPublisher(),
- {
- $0.textUI.value = $1
- $0.textUI.isRecent = true
- },
- { m, _ in m.textUI.isRecent = false }
- )
-
-
-
-
- }
-
- }
- }
|