diff --git a/Modules/MicX/Mic/src/Mic.K.swift b/Modules/MicX/Mic/src/Mic.K.swift index fa528df..4cd13bf 100644 --- a/Modules/MicX/Mic/src/Mic.K.swift +++ b/Modules/MicX/Mic/src/Mic.K.swift @@ -4,7 +4,7 @@ public extension Mic { public static let activityDate = "Mic.activityDate" public static let activityDates = "Mic.activityDates" public static let isActive = "Mic.isActive" - public static let MI = "MicItem.Model" + public static let MI = "MicItem" public static let requestActivityDate = "Mic.requestActivityDate" public static let timeout = "Mic.timeout" } diff --git a/Modules/MicX/MicItem/src/MicItem.WillBe.swift b/Modules/MicX/MicItem/src/MicItem.Generated.swift similarity index 71% rename from Modules/MicX/MicItem/src/MicItem.WillBe.swift rename to Modules/MicX/MicItem/src/MicItem.Generated.swift index 0efe274..99b1bf7 100644 --- a/Modules/MicX/MicItem/src/MicItem.WillBe.swift +++ b/Modules/MicX/MicItem/src/MicItem.Generated.swift @@ -1,5 +1,14 @@ +// ВНИМАНИЕ Сгенерировано автоматом из файла MicItem.yml +// ВНИМАНИЕ Не менять руками! + +import AELog import BusX +import Combine +import Foundation import MPAKX +import UIKit + +// MARK: - Context public protocol MicItemContext { var activityDate: MPAK.Recent { get } @@ -7,13 +16,16 @@ public protocol MicItemContext { } extension MicItem { + + // MARK: - Model + public struct Model: MicItemContext { public var activityDate: MPAK.Recent = .init(nil) public var timeout: Bool = false } -} -extension MicItem { + // MARK: - Controller + final class Controller: MPAK.Controller { init(_ id: String? = nil) { var sid = "" @@ -22,19 +34,17 @@ extension MicItem { } super.init( MicItem.Model(), - debugClassName: "MicICtrl", - debugLog: { print("\($0)\(sid)") } + debugClassName: "MicItemCtrl", + debugLog: { aelog("\($0)\(sid)") } ) - - // Нижеследующее предстоит сгенерить. + // Отправляем модель в Шину. m - .sink { v in Bus.send(Bus.keyId(K.MI, id), v) } + .sink { v in Bus.send(Bus.keyId("MicItem", id), v) } .store(in: &subscriptions) pipeValue( dbg: "activityD", - sub: nil, Bus.events.compactMap { Bus.convertKeyValue(Bus.keyId(K.activityDate, id), $0) }.map { (k: String, v: Date?) in v }.eraseToAnyPublisher(), { $0.activityDate.value = $1 @@ -42,10 +52,8 @@ extension MicItem { }, { m, _ in m.activityDate.isRecent = false } ) - pipe( dbg: "timeout", - sub: nil, Bus.events.compactMap { Bus.convertKeyValue(Bus.keyId(K.timeout, id), $0) }.map { (k: String, v: Bool) in v }.eraseToAnyPublisher(), { $0.timeout = true }, { $0.timeout = false }