Compare commits
1 Commits
cfe804522f
...
single
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32bfd5227e |
@@ -1,54 +0,0 @@
|
|||||||
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
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
extension MPAK {
|
|
||||||
public struct Many<T> {
|
|
||||||
public var keys = Set<String>()
|
|
||||||
public var dict = [String: T]()
|
|
||||||
|
|
||||||
public init() { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
extension MPAK {
|
|
||||||
public struct Recent<T> {
|
|
||||||
public var isRecent = false
|
|
||||||
public var value: T
|
|
||||||
|
|
||||||
public init(_ value: T) {
|
|
||||||
self.value = value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +1,10 @@
|
|||||||
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,14 +47,12 @@ 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,9 +7,6 @@ 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"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
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)
|
|
||||||
])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
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,8 +7,15 @@ 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,7 +36,6 @@ 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,10 +4,9 @@ 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.TV("uuid-2")
|
MeetupId.V()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user