Compare commits
16 Commits
single
...
cfe804522f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cfe804522f | ||
|
|
1f501d8276 | ||
|
|
de42152b9f | ||
|
|
c3265592a7 | ||
|
|
895f74440b | ||
|
|
af7ddfa161 | ||
|
|
f4bb4e50e3 | ||
|
|
a018cbee59 | ||
|
|
676ec75bef | ||
|
|
f11dde1c8e | ||
|
|
676a1ada17 | ||
|
|
f3807b76f6 | ||
|
|
56512ca26a | ||
|
|
a5de0484fd | ||
|
|
f838021562 | ||
|
|
752b34b95d |
54
Modules/BusX/BusUI/src/BusUI.ManyTextField.swift
Normal file
54
Modules/BusX/BusUI/src/BusUI.ManyTextField.swift
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import Combine
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
extension BusUI {
|
||||||
|
public final class ManyTextField: ObservableObject {
|
||||||
|
let textApp: String
|
||||||
|
let textUI: String
|
||||||
|
@Published public var id: String?
|
||||||
|
@Published public var v = "a:"
|
||||||
|
var subscriptions = [AnyCancellable]()
|
||||||
|
var sub = [AnyCancellable]()
|
||||||
|
|
||||||
|
public init(
|
||||||
|
_ textApp: String,
|
||||||
|
_ textUI: String
|
||||||
|
) {
|
||||||
|
self.textApp = textApp
|
||||||
|
self.textUI = textUI
|
||||||
|
|
||||||
|
/**///print("ИГР BusUTF(\(Unmanaged.passUnretained(self).toOpaque())).init textA/textU: '\(textApp)'/'\(textUI)'")
|
||||||
|
|
||||||
|
$id
|
||||||
|
.sink { [weak self] v in self?.setup(v) }
|
||||||
|
.store(in: &sub)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func setup(_ id: String?) {
|
||||||
|
/**/print("ИГР BusUTF(\(Unmanaged.passUnretained(self).toOpaque())).setup id: '\(id)'")
|
||||||
|
|
||||||
|
subscriptions = []
|
||||||
|
|
||||||
|
Bus.sendSync(
|
||||||
|
textUI,
|
||||||
|
$v
|
||||||
|
.removeDuplicates()
|
||||||
|
.compactMap(onlyUIText)
|
||||||
|
.compactMap { v in
|
||||||
|
if let id {
|
||||||
|
return "\(id):\(v)"
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
.eraseToAnyPublisher(),
|
||||||
|
&subscriptions
|
||||||
|
)
|
||||||
|
|
||||||
|
Bus.receiveSync(
|
||||||
|
[textApp],
|
||||||
|
{ [weak self] (_, v: String) in self?.v = "a:\(v)" },
|
||||||
|
&subscriptions
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
Modules/MPAKX/src/MPAK.Many.swift
Normal file
8
Modules/MPAKX/src/MPAK.Many.swift
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
extension MPAK {
|
||||||
|
public struct Many<T> {
|
||||||
|
public var keys = Set<String>()
|
||||||
|
public var dict = [String: T]()
|
||||||
|
|
||||||
|
public init() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
10
Modules/MPAKX/src/MPAK.Recent.swift
Normal file
10
Modules/MPAKX/src/MPAK.Recent.swift
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
extension MPAK {
|
||||||
|
public struct Recent<T> {
|
||||||
|
public var isRecent = false
|
||||||
|
public var value: T
|
||||||
|
|
||||||
|
public init(_ value: T) {
|
||||||
|
self.value = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1 @@
|
|||||||
public enum MPAK {
|
public enum MPAK { }
|
||||||
public struct Recent<T> {
|
|
||||||
public var isRecent = false
|
|
||||||
public var value: T
|
|
||||||
|
|
||||||
public init(_ value: T) {
|
|
||||||
self.value = value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -47,12 +47,14 @@ extension MeetupId {
|
|||||||
let ctrl = Controller()
|
let ctrl = Controller()
|
||||||
let world: World
|
let world: World
|
||||||
|
|
||||||
|
var any = [Any]()
|
||||||
var subscriptions = [AnyCancellable]()
|
var subscriptions = [AnyCancellable]()
|
||||||
static private(set) weak var singleton: Service?
|
static private(set) weak var singleton: Service?
|
||||||
|
|
||||||
public init(_ world: World) {
|
public init(_ world: World) {
|
||||||
self.world = world
|
self.world = world
|
||||||
Self.singleton = self
|
Self.singleton = self
|
||||||
|
SectionBus.setupService(ctrl, self, world)
|
||||||
SectionGenerated.setupPlatform(ctrl, self, world)
|
SectionGenerated.setupPlatform(ctrl, self, world)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ public extension MeetupId {
|
|||||||
static let M = "MeetupId"
|
static let M = "MeetupId"
|
||||||
static let textApp = "MeetupId.textApp"
|
static let textApp = "MeetupId.textApp"
|
||||||
static let textUI = "MeetupId.textUI"
|
static let textUI = "MeetupId.textUI"
|
||||||
|
|
||||||
|
static let testTextApp = "MeetupId.testTextApp"
|
||||||
|
static let testTextUI = "MeetupId.testTextUI"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
18
Modules/MeetupIdX/src/MeetupId.SectionBus.swift
Normal file
18
Modules/MeetupIdX/src/MeetupId.SectionBus.swift
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import BusX
|
||||||
|
|
||||||
|
extension MeetupId {
|
||||||
|
enum SectionBus {
|
||||||
|
static func setupService(
|
||||||
|
_ ctrl: Controller,
|
||||||
|
_ service: Service,
|
||||||
|
_ world: World
|
||||||
|
) {
|
||||||
|
service.any.append(contentsOf: [
|
||||||
|
Bus.Debounce(shouldResetText, 0.2, K.M, K.textApp),
|
||||||
|
Bus.Delay(shouldFinishLoading, 5, K.M, K.finishLoading),
|
||||||
|
Bus.Sync(shouldEnableJoin, K.M, K.isJoinAvailable),
|
||||||
|
Bus.Sync(shouldResetLoading, K.M, K.isLoading)
|
||||||
|
])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
27
Modules/MeetupIdX/src/MeetupId.TV.swift
Normal file
27
Modules/MeetupIdX/src/MeetupId.TV.swift
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import BusX
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
extension MeetupId {
|
||||||
|
public struct TV: View {
|
||||||
|
let id: String
|
||||||
|
@StateObject var vm = VM()
|
||||||
|
|
||||||
|
public init(_ id: String) {
|
||||||
|
self.id = id
|
||||||
|
}
|
||||||
|
|
||||||
|
public var body: some View {
|
||||||
|
TextField("TV", value: $vm.textField.v, formatter: BusUI.TextFieldSource())
|
||||||
|
.padding(8)
|
||||||
|
.border(Color.blue)
|
||||||
|
.animation(.easeInOut(duration: 0.3))
|
||||||
|
.onAppear {
|
||||||
|
vm.setup(id)
|
||||||
|
}
|
||||||
|
.onChange(of: id) { newValue in
|
||||||
|
vm.setup(newValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
18
Modules/MeetupIdX/src/MeetupId.TVM.swift
Normal file
18
Modules/MeetupIdX/src/MeetupId.TVM.swift
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import BusX
|
||||||
|
import Combine
|
||||||
|
|
||||||
|
extension MeetupId {
|
||||||
|
public final class VM: ObservableObject {
|
||||||
|
@Published public var id: String?
|
||||||
|
@Published var textField = BusUI.TextField(K.testTextApp, K.testTextUI)
|
||||||
|
var subscriptions = [AnyCancellable]()
|
||||||
|
|
||||||
|
public init() { }
|
||||||
|
|
||||||
|
public func setup(_ id: String) {
|
||||||
|
/**/print("ИГР MeetupIV(\(Unmanaged.passUnretained(self).toOpaque())).setup id: '\(id)'")
|
||||||
|
textField.id = id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -7,15 +7,8 @@ extension MeetupId {
|
|||||||
@StateObject var isLoading = BusUI.Value(K.isLoading, false)
|
@StateObject var isLoading = BusUI.Value(K.isLoading, false)
|
||||||
@StateObject var join = BusUI.Button(K.join)
|
@StateObject var join = BusUI.Button(K.join)
|
||||||
@StateObject var textField = BusUI.TextField(K.textApp, K.textUI)
|
@StateObject var textField = BusUI.TextField(K.textApp, K.textUI)
|
||||||
let processors: [Any]
|
|
||||||
|
|
||||||
public init() {
|
public init() {
|
||||||
processors = [
|
|
||||||
Bus.Debounce(shouldResetText, 0.2, K.M, K.textApp),
|
|
||||||
Bus.Delay(shouldFinishLoading, 5, K.M, K.finishLoading),
|
|
||||||
Bus.Sync(shouldEnableJoin, K.M, K.isJoinAvailable),
|
|
||||||
Bus.Sync(shouldResetLoading, K.M, K.isLoading)
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public var body: some View {
|
public var body: some View {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ extension %MODULE% {
|
|||||||
let ctrl = Controller()
|
let ctrl = Controller()
|
||||||
let world: World
|
let world: World
|
||||||
%SERVICE_CORE%
|
%SERVICE_CORE%
|
||||||
|
var any = [Any]()
|
||||||
var subscriptions = [AnyCancellable]()
|
var subscriptions = [AnyCancellable]()
|
||||||
static private(set) weak var singleton: Service?
|
static private(set) weak var singleton: Service?
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ import UIKit
|
|||||||
|
|
||||||
struct Content: View {
|
struct Content: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
MeetupId.V()
|
//MeetupId.V()
|
||||||
|
MeetupId.TV("uuid-1")
|
||||||
Divider()
|
Divider()
|
||||||
MeetupId.V()
|
MeetupId.TV("uuid-2")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user