From bdeee67b3823bfc7772219a6ecccd9c31f031c49 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: Fri, 29 Dec 2023 13:11:32 +0300 Subject: [PATCH] d --- Modules/CordX/CordX.podspec | 2 +- Modules/CordX/src/Cord.Button.swift | 4 ++-- Modules/CordX/src/Cord.Receive.swift | 6 +++--- Modules/CordX/src/Cord.TextField.swift | 6 +++--- Modules/MeetupIdX/src/MeetupId.V.swift | 25 ++++++++++++------------- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Modules/CordX/CordX.podspec b/Modules/CordX/CordX.podspec index 491ecdd..5669254 100644 --- a/Modules/CordX/CordX.podspec +++ b/Modules/CordX/CordX.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'CordX' -s.version = '2023.12.28' +s.version = '2023.12.29' s.license = 'IVCS' s.summary = 'Упрощённое общение с шиной из SwiftUI' s.homepage = 'IVCS' diff --git a/Modules/CordX/src/Cord.Button.swift b/Modules/CordX/src/Cord.Button.swift index c4b4242..15d60b4 100644 --- a/Modules/CordX/src/Cord.Button.swift +++ b/Modules/CordX/src/Cord.Button.swift @@ -3,13 +3,13 @@ import Combine extension Cord { public final class Button: ObservableObject { - public let press = PassthroughSubject() + public let v = PassthroughSubject() var subscriptions = [AnyCancellable]() public init(_ key: String) { Bus.send( key, - press.eraseToAnyPublisher(), + v.eraseToAnyPublisher(), sub: &subscriptions ) } diff --git a/Modules/CordX/src/Cord.Receive.swift b/Modules/CordX/src/Cord.Receive.swift index 9b8e88a..4fe686b 100644 --- a/Modules/CordX/src/Cord.Receive.swift +++ b/Modules/CordX/src/Cord.Receive.swift @@ -3,17 +3,17 @@ import Combine extension Cord { public final class Receive: ObservableObject { - @Published public var value: T + @Published public var v: T var subscriptions = [AnyCancellable]() public init( _ key: String, _ defaultValue: T ) { - value = defaultValue + v = defaultValue Bus.receive( [key], - { [weak self] (_, v: T) in self?.value = v }, + { [weak self] (_, v: T) in self?.v = v }, sub: &subscriptions ) } diff --git a/Modules/CordX/src/Cord.TextField.swift b/Modules/CordX/src/Cord.TextField.swift index 4659dec..d5c8126 100644 --- a/Modules/CordX/src/Cord.TextField.swift +++ b/Modules/CordX/src/Cord.TextField.swift @@ -4,7 +4,7 @@ import SwiftUI extension Cord { public final class TextField: ObservableObject { - @Published public var value = "a:" + @Published public var v = "a:" var subscriptions = [AnyCancellable]() public init( @@ -13,7 +13,7 @@ extension Cord { ) { Bus.send( textUI, - $value + $v .removeDuplicates() .compactMap(onlyUIText) .eraseToAnyPublisher(), @@ -22,7 +22,7 @@ extension Cord { Bus.receive( [textApp], - { [weak self] (_, v: String) in self?.value = "a:\(v)" }, + { [weak self] (_, v: String) in self?.v = "a:\(v)" }, sub: &subscriptions ) } diff --git a/Modules/MeetupIdX/src/MeetupId.V.swift b/Modules/MeetupIdX/src/MeetupId.V.swift index 36bedab..c097b25 100644 --- a/Modules/MeetupIdX/src/MeetupId.V.swift +++ b/Modules/MeetupIdX/src/MeetupId.V.swift @@ -5,35 +5,34 @@ import SwiftUI extension MeetupId { public struct V: View { @StateObject var fmt = MeetupId.Formatter(K.textUI, K.textApp) - @StateObject var isJA = Cord.Receive(K.isJoinAvailable, false) - @StateObject var isL = Cord.Receive(K.isLoading, false) + @StateObject var isJoinAvailable = Cord.Receive(K.isJoinAvailable, false) + @StateObject var isLoading = Cord.Receive(K.isLoading, false) @StateObject var join = Cord.Button(K.join) - @StateObject var txtF = Cord.TextField(K.textApp, K.textUI) + @StateObject var textField = Cord.TextField(K.textApp, K.textUI) let pSEJ = Bus.Processor(shouldEnableJoin, K.M, K.isJoinAvailable) - let pSRL = Bus.Processor(shouldResetLoading, K.M, K.isLoading) public init() { } public var body: some View { - VStack { + VStack(spacing: 8) { HStack { - TextField("Binding-3", value: $txtF.value, formatter: Cord.TextFieldValueOwner()) + TextField("Binding-3", value: $textField.v, formatter: Cord.TextFieldValueOwner()) .padding(8) .border(Color.blue, width: 2) - if isL.value { - ProgressView() - } + ProgressView() + .padding(8) + .opacity(isLoading.v ? 1 : 0) } - Button(action: join.press.send) { + Button(action: join.v.send) { Text("Join") .padding(8) .border( - isJA.value ? Color.green : Color.gray, - width: isJA.value ? 4 : 1 + isJoinAvailable.v ? Color.green : Color.gray, + width: isJoinAvailable.v ? 4 : 1 ) } - .disabled(!isJA.value) + .disabled(!isJoinAvailable.v) } .frame(width: 320) .padding()