From 514e06e8fe33bae8144187cb2e79574f7109f8de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Thu, 28 Dec 2023 15:46:33 +0300 Subject: [PATCH] d --- Modules/BusX/src/Bus.Processor.swift | 4 ++-- Modules/MeetupIdX/src/MeetupId.Generated.swift | 4 ++-- Modules/MeetupIdX/src/MeetupId.K.swift | 11 ++++++----- Modules/MeetupIdX/src/MeetupId.Shoulds.swift | 7 +++++++ Modules/MeetupIdX/src/MeetupId.V.swift | 8 ++++---- Utilities/platform/2/generation/pipeSource.py | 2 +- 6 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 Modules/MeetupIdX/src/MeetupId.Shoulds.swift diff --git a/Modules/BusX/src/Bus.Processor.swift b/Modules/BusX/src/Bus.Processor.swift index be3fd14..c116f78 100644 --- a/Modules/BusX/src/Bus.Processor.swift +++ b/Modules/BusX/src/Bus.Processor.swift @@ -5,18 +5,18 @@ public extension Bus { var subscriptions = [AnyCancellable]() public init( + _ handler: @escaping ((Src) -> Dst?), _ keyIn: String, _ keyOut: String, - _ handler: @escaping ((Src) -> Dst?), opt: [Option] = [] ) { Bus.process([keyIn], keyOut, handler, opt: opt, sub: &subscriptions) } public init( + _ handler: @escaping ((Src) -> Dst?), _ keysIn: Set, _ keyOut: String, - _ handler: @escaping ((Src) -> Dst?), opt: [Option] = [] ) { Bus.process(keysIn, keyOut, handler, opt: opt, sub: &subscriptions) diff --git a/Modules/MeetupIdX/src/MeetupId.Generated.swift b/Modules/MeetupIdX/src/MeetupId.Generated.swift index 729b3df..1b2eb2c 100644 --- a/Modules/MeetupIdX/src/MeetupId.Generated.swift +++ b/Modules/MeetupIdX/src/MeetupId.Generated.swift @@ -90,7 +90,7 @@ extension MeetupId { ctrl.pipeValue( dbg: "textA", sub: nil, - Bus.events.compactMap { Bus.convertKeyValue(K.meetupIdTextApp.rawValue, $0) }.map { (k: String, v: String) in v }.eraseToAnyPublisher().eraseToAnyPublisher(), + Bus.events.compactMap { Bus.convertKeyValue(K.meetupIdTextApp, $0) }.map { (k: String, v: String) in v }.eraseToAnyPublisher().eraseToAnyPublisher(), { $0.textApp.value = $1 $0.textApp.isRecent = true @@ -103,7 +103,7 @@ extension MeetupId { ctrl.pipeValue( dbg: "textUI", sub: nil, - Bus.events.compactMap { Bus.convertKeyValue(K.meetupIdTextUI.rawValue, $0) }.map { (k: String, v: String) in v }.eraseToAnyPublisher().eraseToAnyPublisher(), + Bus.events.compactMap { Bus.convertKeyValue(K.meetupIdTextUI, $0) }.map { (k: String, v: String) in v }.eraseToAnyPublisher().eraseToAnyPublisher(), { $0.textUI.value = $1 $0.textUI.isRecent = true diff --git a/Modules/MeetupIdX/src/MeetupId.K.swift b/Modules/MeetupIdX/src/MeetupId.K.swift index a374373..80e54fa 100644 --- a/Modules/MeetupIdX/src/MeetupId.K.swift +++ b/Modules/MeetupIdX/src/MeetupId.K.swift @@ -1,9 +1,10 @@ public extension MeetupId { - enum K: String { - case meetupIdIsJoinAvailable - case meetupIdJoin - case meetupIdTextApp - case meetupIdTextUI + enum K { + static let isJoinAvailable = "MeetupId.isJoinAvailable" + static let join = "MeetupId.join" + static let M = "MeetupId" + static let textApp = "MeetupId.textApp" + static let textUI = "MeetupId.textUI" } } diff --git a/Modules/MeetupIdX/src/MeetupId.Shoulds.swift b/Modules/MeetupIdX/src/MeetupId.Shoulds.swift new file mode 100644 index 0000000..d9bf1da --- /dev/null +++ b/Modules/MeetupIdX/src/MeetupId.Shoulds.swift @@ -0,0 +1,7 @@ +import Foundation + +public extension MeetupId { + static func shouldEnableJoin(_ c: MeetupIdContext) -> Bool? { + return nil + } +} diff --git a/Modules/MeetupIdX/src/MeetupId.V.swift b/Modules/MeetupIdX/src/MeetupId.V.swift index c16b518..d5d16c4 100644 --- a/Modules/MeetupIdX/src/MeetupId.V.swift +++ b/Modules/MeetupIdX/src/MeetupId.V.swift @@ -4,10 +4,10 @@ import SwiftUI extension MeetupId { public struct V: View { - @StateObject var isJA = Cord.Receive(K.meetupIdIsJoinAvailable.rawValue, false) - @StateObject var join = Cord.Button(K.meetupIdJoin.rawValue) - @StateObject var txtF = Cord.TextField(K.meetupIdTextApp.rawValue, K.meetupIdTextUI.rawValue) - let test = Bus.Processor(K.meetupIdTextUI.rawValue, K.meetupIdIsJoinAvailable.rawValue, onlyAllowJoin) + @StateObject var isJA = Cord.Receive(K.isJoinAvailable, false) + @StateObject var join = Cord.Button(K.join) + @StateObject var txtF = Cord.TextField(K.textApp, K.textUI) + let joinA = Bus.Processor(shouldEnableJoin, K.M, K.isJoinAvailable) public init() { } diff --git a/Utilities/platform/2/generation/pipeSource.py b/Utilities/platform/2/generation/pipeSource.py index ac15fcd..3743322 100644 --- a/Utilities/platform/2/generation/pipeSource.py +++ b/Utilities/platform/2/generation/pipeSource.py @@ -18,7 +18,7 @@ def pipeSource(name, entity, structure): elif src.startswith("K."): busKey = src busValueType = structure.model.fields[name][0] - src = "Bus.events.compactMap { Bus.convertKeyValue(" + busKey + ".rawValue, $0) }.map { (k: String, v: " + busValueType + ") in v }.eraseToAnyPublisher()" + src = "Bus.events.compactMap { Bus.convertKeyValue(" + busKey + ", $0) }.map { (k: String, v: " + busValueType + ") in v }.eraseToAnyPublisher()" # Значение по умолчанию. elif src == default: return default + "." + name