@@ -8,9 +8,6 @@ public extension Bus { | |||||
key == v.key, | key == v.key, | ||||
let value = v.value as? T | let value = v.value as? T | ||||
else { | else { | ||||
if key == "MeetupId.finishLoading" { | |||||
/**/print("ИГР Bus.convertKV failed k/v/T: '\(key)'/'\(v)'/'\(type(of: T.self))'") | |||||
} | |||||
return nil | return nil | ||||
} | } | ||||
return (key, value) | return (key, value) |
@@ -20,7 +20,6 @@ extension Bus { | |||||
var subscriptions = [AnyCancellable]() | var subscriptions = [AnyCancellable]() | ||||
func send(_ key: String, _ value: Any) { | func send(_ key: String, _ value: Any) { | ||||
/**/print("ИГР BusS.send key/value: '\(key)'/'\(value)'") | |||||
events.send((key, value)) | events.send((key, value)) | ||||
} | } | ||||
} | } |
@@ -1,4 +1,4 @@ | |||||
extension Cord { | |||||
extension BusUI { | |||||
/// Пропускаем лишь значения от UI | /// Пропускаем лишь значения от UI | ||||
/// | /// | ||||
/// - Returns: Значение без префиксов "a:"/"u:" | /// - Returns: Значение без префиксов "a:"/"u:" |
@@ -1,7 +1,6 @@ | |||||
import BusX | |||||
import Combine | import Combine | ||||
extension Cord { | |||||
extension BusUI { | |||||
public final class Button: ObservableObject { | public final class Button: ObservableObject { | ||||
public let v = PassthroughSubject<Void, Never>() | public let v = PassthroughSubject<Void, Never>() | ||||
var subscriptions = [AnyCancellable]() | var subscriptions = [AnyCancellable]() |
@@ -1,8 +1,7 @@ | |||||
import BusX | |||||
import Combine | import Combine | ||||
import SwiftUI | import SwiftUI | ||||
extension Cord { | |||||
extension BusUI { | |||||
public final class TextField: ObservableObject { | public final class TextField: ObservableObject { | ||||
@Published public var v = "a:" | @Published public var v = "a:" | ||||
var subscriptions = [AnyCancellable]() | var subscriptions = [AnyCancellable]() |
@@ -1,12 +1,15 @@ | |||||
import Foundation | import Foundation | ||||
extension Cord { | |||||
public final class TextFieldValueOwner: Formatter { | |||||
extension BusUI { | |||||
public final class TextFieldSource: Formatter { | |||||
/// Выдаём для отображения очищенную от источника строку. | |||||
public override func string(for obj: Any?) -> String? { | public override func string(for obj: Any?) -> String? { | ||||
guard let str = obj as? String else { return nil } | guard let str = obj as? String else { return nil } | ||||
return String(str.dropFirst(2)) | return String(str.dropFirst(2)) | ||||
} | } | ||||
/// Выдаём для использования кодом строку с указанием источника | |||||
/// в виде пользователя `u:` | |||||
public override func getObjectValue( | public override func getObjectValue( | ||||
_ obj: AutoreleasingUnsafeMutablePointer<AnyObject?>?, | _ obj: AutoreleasingUnsafeMutablePointer<AnyObject?>?, | ||||
for string: String, | for string: String, |
@@ -1,8 +1,7 @@ | |||||
import BusX | |||||
import Combine | import Combine | ||||
extension Cord { | |||||
public final class Receive<T>: ObservableObject { | |||||
extension BusUI { | |||||
public final class Value<T>: ObservableObject { | |||||
@Published public var v: T | @Published public var v: T | ||||
var subscriptions = [AnyCancellable]() | var subscriptions = [AnyCancellable]() | ||||
@@ -0,0 +1 @@ | |||||
public enum BusUI { } |
@@ -1,13 +1,13 @@ | |||||
Pod::Spec.new do |s| | Pod::Spec.new do |s| | ||||
s.name = 'BusX' | s.name = 'BusX' | ||||
s.version = '2023.12.28' | |||||
s.version = '2023.12.30' | |||||
s.license = 'IVCS' | s.license = 'IVCS' | ||||
s.summary = 'Шина общения элементов приложения' | s.summary = 'Шина общения элементов приложения' | ||||
s.homepage = 'IVCS' | s.homepage = 'IVCS' | ||||
s.author = 'IVCS' | s.author = 'IVCS' | ||||
s.source = { :git => 'https://fake.com/FAKE.git', :tag => s.version } | s.source = { :git => 'https://fake.com/FAKE.git', :tag => s.version } | ||||
s.source_files = 'src/**/*.swift' | |||||
s.source_files = '**/**/*.swift' | |||||
s.swift_version = '5.2' | s.swift_version = '5.2' | ||||
s.ios.deployment_target = '14.0' | s.ios.deployment_target = '14.0' | ||||
@@ -1,30 +0,0 @@ | |||||
import Combine | |||||
public extension Bus { | |||||
final class Receiver<T> { | |||||
var subscriptions = [AnyCancellable]() | |||||
public init( | |||||
_ keys: Set<String>, | |||||
_ handler: @escaping ((String, T) -> Void), | |||||
opt: [Option] = [] | |||||
) { | |||||
Bus.receive(keys, handler, opt: opt, sub: &subscriptions) | |||||
} | |||||
} | |||||
} | |||||
import Combine | |||||
public extension Bus { | |||||
final class Sender<T> { | |||||
var subscriptions = [AnyCancellable]() | |||||
public init( | |||||
_ key: String, | |||||
_ node: AnyPublisher<T, Never>, | |||||
opt: [Option] = [] | |||||
) { | |||||
Bus.send(key, node, opt: opt, sub: &subscriptions) | |||||
} | |||||
} | |||||
} |
@@ -1,15 +0,0 @@ | |||||
Pod::Spec.new do |s| | |||||
s.name = 'CordX' | |||||
s.version = '2023.12.29' | |||||
s.license = 'IVCS' | |||||
s.summary = 'Упрощённое общение с шиной из SwiftUI' | |||||
s.homepage = 'IVCS' | |||||
s.author = 'IVCS' | |||||
s.source = { :git => 'https://fake.com/FAKE.git', :tag => s.version } | |||||
s.source_files = 'src/**/*.swift' | |||||
s.swift_version = '5.2' | |||||
s.ios.deployment_target = '14.0' | |||||
s.dependency 'BusX' | |||||
end |
@@ -1 +0,0 @@ | |||||
public enum Cord { } |
@@ -12,7 +12,6 @@ s.swift_version = '5.2' | |||||
s.ios.deployment_target = '14.0' | s.ios.deployment_target = '14.0' | ||||
s.dependency 'AELog' | s.dependency 'AELog' | ||||
s.dependency 'BusX' | s.dependency 'BusX' | ||||
s.dependency 'CordX' | |||||
s.dependency 'MPAKX' | s.dependency 'MPAKX' | ||||
end | end |
@@ -4,7 +4,6 @@ | |||||
import AELog | import AELog | ||||
import BusX | import BusX | ||||
import Combine | import Combine | ||||
import CordX | |||||
import Foundation | import Foundation | ||||
import MPAKX | import MPAKX | ||||
import UIKit | import UIKit | ||||
@@ -1,13 +1,12 @@ | |||||
import BusX | import BusX | ||||
import CordX | |||||
import SwiftUI | import SwiftUI | ||||
extension MeetupId { | extension MeetupId { | ||||
public struct V: View { | public struct V: View { | ||||
@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 textField = Cord.TextField(K.textApp, K.textUI) | |||||
@StateObject var isJoinAvailable = BusUI.Value(K.isJoinAvailable, false) | |||||
@StateObject var isLoading = BusUI.Value(K.isLoading, false) | |||||
@StateObject var join = BusUI.Button(K.join) | |||||
@StateObject var textField = BusUI.TextField(K.textApp, K.textUI) | |||||
let processors: [Any] = [ | let processors: [Any] = [ | ||||
Bus.Processor(shouldEnableJoin, K.M, K.isJoinAvailable), | Bus.Processor(shouldEnableJoin, K.M, K.isJoinAvailable), | ||||
MeetupId.Debounce(0.2, formatId, K.textUI, K.textApp), | MeetupId.Debounce(0.2, formatId, K.textUI, K.textApp), | ||||
@@ -19,7 +18,7 @@ extension MeetupId { | |||||
public var body: some View { | public var body: some View { | ||||
VStack(spacing: 8) { | VStack(spacing: 8) { | ||||
HStack { | HStack { | ||||
TextField("Binding-3", value: $textField.v, formatter: Cord.TextFieldValueOwner()) | |||||
TextField("Binding-3", value: $textField.v, formatter: BusUI.TextFieldSource()) | |||||
.disabled(isLoading.v) | .disabled(isLoading.v) | ||||
.padding(8) | .padding(8) | ||||
.border( | .border( | ||||
@@ -5,7 +5,6 @@ platform :ios, '14.0' | |||||
pod 'AELog' | pod 'AELog' | ||||
pod 'BusX', :path => '../Modules/BusX' | pod 'BusX', :path => '../Modules/BusX' | ||||
pod 'CordX', :path => '../Modules/CordX' | |||||
pod 'MeetupIdX', :path => '../Modules/MeetupIdX' | pod 'MeetupIdX', :path => '../Modules/MeetupIdX' | ||||
pod 'MPAKX', :path => '../Modules/MPAKX' | pod 'MPAKX', :path => '../Modules/MPAKX' | ||||
@@ -1,19 +1,15 @@ | |||||
PODS: | PODS: | ||||
- AELog (0.6.3) | - AELog (0.6.3) | ||||
- BusX (2023.12.28) | |||||
- CordX (2023.12.29): | |||||
- BusX | |||||
- BusX (2023.12.30) | |||||
- MeetupIdX (2023.12.28): | - MeetupIdX (2023.12.28): | ||||
- AELog | - AELog | ||||
- BusX | - BusX | ||||
- CordX | |||||
- MPAKX | - MPAKX | ||||
- MPAKX (2023.12.15) | - MPAKX (2023.12.15) | ||||
DEPENDENCIES: | DEPENDENCIES: | ||||
- AELog | - AELog | ||||
- BusX (from `../Modules/BusX`) | - BusX (from `../Modules/BusX`) | ||||
- CordX (from `../Modules/CordX`) | |||||
- MeetupIdX (from `../Modules/MeetupIdX`) | - MeetupIdX (from `../Modules/MeetupIdX`) | ||||
- MPAKX (from `../Modules/MPAKX`) | - MPAKX (from `../Modules/MPAKX`) | ||||
@@ -24,8 +20,6 @@ SPEC REPOS: | |||||
EXTERNAL SOURCES: | EXTERNAL SOURCES: | ||||
BusX: | BusX: | ||||
:path: "../Modules/BusX" | :path: "../Modules/BusX" | ||||
CordX: | |||||
:path: "../Modules/CordX" | |||||
MeetupIdX: | MeetupIdX: | ||||
:path: "../Modules/MeetupIdX" | :path: "../Modules/MeetupIdX" | ||||
MPAKX: | MPAKX: | ||||
@@ -33,11 +27,10 @@ EXTERNAL SOURCES: | |||||
SPEC CHECKSUMS: | SPEC CHECKSUMS: | ||||
AELog: f732b70f7a9d1b4c6a3676304192b3908f362133 | AELog: f732b70f7a9d1b4c6a3676304192b3908f362133 | ||||
BusX: fd22c04ad544d131e66315c1a33d87d85b19712e | |||||
CordX: f8ba6a8db42f9f27142948b536b9b8272f9b977c | |||||
MeetupIdX: b214163e32acffd0a5283062e9d69aaf5a5b66e6 | |||||
BusX: d11e857e9cb762f649ee9f88fd5a4f8fbf5bf96b | |||||
MeetupIdX: 80e2257016a043b10dd77e1e9a59d083bef21323 | |||||
MPAKX: dc592434f55edf34709f6e4f37c9ec90dcd95185 | MPAKX: dc592434f55edf34709f6e4f37c9ec90dcd95185 | ||||
PODFILE CHECKSUM: 35ca81ffde7ba64c51870ff39b799f407bf0fbde | |||||
PODFILE CHECKSUM: ff31073a9b868750f1cfabf6c1c740dbf32d4cb1 | |||||
COCOAPODS: 1.13.0 | COCOAPODS: 1.13.0 |