Михаил Капелько před 9 měsíci
rodič
revize
8bb677258f
3 změnil soubory, kde provedl 132 přidání a 58 odebrání
  1. +130
    -0
      Modules/MicX/MicItem/src/MicItem.Generated.swift
  2. +0
    -56
      Modules/MicX/MicItem/src/MicItem.WillBe.swift
  3. +2
    -2
      app/Podfile.lock

+ 130
- 0
Modules/MicX/MicItem/src/MicItem.Generated.swift Zobrazit soubor

@@ -0,0 +1,130 @@
// ВНИМАНИЕ Сгенерировано автоматом из файла MicItem.yml
// ВНИМАНИЕ Не менять руками!

import AELog
import BusX
import Combine
import Foundation
import MPAKX
import UIKit

// MARK: - Context

public protocol MicItemContext {
var activityDates: MPAK.Recent<Date?> { get }
var exReallyTest1: Bool? { get }
var reallyTest1: Bool { get }
var test2: Bool { get }
var test3: Bool { get }
var test4: Bool { get }
var test5: MPAK.Recent<Bool> { get }
var test6: MPAK.Recent<Bool> { get }
var test7: MPAK.Recent<Bool> { get }
var timeout: Bool { get }
}

extension MicItem {

// MARK: - Model

public struct Model: MicItemContext {
public var activityDates: MPAK.Recent<Date?> = .init(nil)
public var exReallyTest1: Bool? = nil
public var reallyTest1: Bool = false
public var test2: Bool = false
public var test3: Bool = false
public var test4: Bool = false
public var test5: MPAK.Recent<Bool> = .init(false)
public var test6: MPAK.Recent<Bool> = .init(false)
public var test7: MPAK.Recent<Bool> = .init(false)
public var timeout: Bool = false
}

// MARK: - Controller

final class Controller: MPAK.Controller<MicItem.Model> {
init(_ id: String? = nil) {
var sid = ""
if let id {
sid = " : \(id)"
}
super.init(
MicItem.Model(),
debugClassName: "MicItemCtrl",
debugLog: { aelog("\($0)\(sid)") }
)

// Отправляем модель в Шину.
m
.sink { v in Bus.send(Bus.keyId("MicItem", id), v) }
.store(in: &subscriptions)

pipeValue(
dbg: "activityD",
Bus.events.compactMap { Bus.convertKeyValue(Bus.keyId(K.activityDates, id), $0) }.map { (k: String, v: Date?) in v }.eraseToAnyPublisher(),
{
$0.activityDates.value = $1
$0.activityDates.isRecent = true
},
{ m, _ in m.activityDates.isRecent = false }
)
pipeValue(
dbg: "reallyT",
Bus.events.compactMap { Bus.convertKeyValue(Bus.keyId(K.reallyTest1, id), $0) }.map { (k: String, v: Bool) in v }.eraseToAnyPublisher(),
{
$0.reallyTest1.value = $1
$0.reallyTest1.isRecent = true
},
{
$0.reallyTest1.isRecent = false
$0.exReallyTest1 = $1
}
)
pipeValue(
dbg: "test2",
Bus.events.compactMap { Bus.convertKeyValue(Bus.keyId(K.test2, id), $0) }.map { (k: String, v: Bool) in v }.eraseToAnyPublisher(),
{ $0.test2 = $1 }
)
pipeValue(
dbg: "test3",
Bus.events.compactMap { Bus.convertKeyValue(Bus.keyId(K.test3, id), $0) }.map { (k: String, v: Bool) in v }.eraseToAnyPublisher(),
{ $0.test3 = $1 },
{ m, _ in m.test3 = nil }
)
pipeValue(
dbg: "test5",
Bus.events.compactMap { Bus.convertKeyValue(Bus.keyId(D.test5, id), $0) }.map { (k: String, v: Bool) in v }.eraseToAnyPublisher(),
{
$0.test5.value = $1
$0.test5.isRecent = true
},
{ m, _ in m.test5.isRecent = false }
)
pipeValue(
dbg: "test6",
Bus.events.compactMap { Bus.convertKeyValue(Bus.keyId(K.abc, id), $0) }.map { (k: String, v: Bool) in v }.eraseToAnyPublisher(),
{
$0.test6.value = $1
$0.test6.isRecent = true
},
{ m, _ in m.test6.isRecent = false }
)
pipeValue(
dbg: "test7",
Bus.events.compactMap { Bus.convertKeyValue(Bus.keyId(D.def, id), $0) }.map { (k: String, v: Bool) in v }.eraseToAnyPublisher(),
{
$0.test7.value = $1
$0.test7.isRecent = true
},
{ m, _ in m.test7.isRecent = false }
)
pipe(
dbg: "timeout",
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 }
)

}
}
}

+ 0
- 56
Modules/MicX/MicItem/src/MicItem.WillBe.swift Zobrazit soubor

@@ -1,56 +0,0 @@
import BusX
import MPAKX

public protocol MicItemContext {
var activityDate: MPAK.Recent<Date?> { get }
var timeout: Bool { get }
}

extension MicItem {
public struct Model: MicItemContext {
public var activityDate: MPAK.Recent<Date?> = .init(nil)
public var timeout: Bool = false
}
}

extension MicItem {
final class Controller: MPAK.Controller<MicItem.Model> {
init(_ id: String? = nil) {
var sid = ""
if let id {
sid = " : \(id)"
}
super.init(
MicItem.Model(),
debugClassName: "MicICtrl",
debugLog: { print("\($0)\(sid)") }
)


// Нижеследующее предстоит сгенерить.
m
.sink { v in Bus.send(Bus.keyId(K.MI, 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
$0.activityDate.isRecent = true
},
{ 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 }
)

}
}
}

+ 2
- 2
app/Podfile.lock Zobrazit soubor

@@ -1,6 +1,6 @@
PODS:
- AELog (0.6.3)
- BusX (2024.01.29)
- BusX (2024.02.01)
- MeetupIdX (2023.12.31):
- AELog
- BusX
@@ -34,7 +34,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
AELog: f732b70f7a9d1b4c6a3676304192b3908f362133
BusX: 99cabace42f33d20aca0ce7941cc62493a1672d9
BusX: c7f39f1d1ffb7d23323609038d54959ab7ed51c7
MeetupIdX: 2fa9fb27717aa8878ff495c1abe960c96e524308
MicX: 6ffa81f29a477a66cde277e3ade3de8ce2d47b91
MPAKX: dc592434f55edf34709f6e4f37c9ec90dcd95185


Načítá se…
Zrušit
Uložit