d
This commit is contained in:
@@ -5,6 +5,7 @@ platform :ios, '14.0'
|
|||||||
# Source.
|
# Source.
|
||||||
pod 'BusX', :path => '../mod/BusX'
|
pod 'BusX', :path => '../mod/BusX'
|
||||||
pod 'CordX', :path => '../mod/CordX'
|
pod 'CordX', :path => '../mod/CordX'
|
||||||
|
pod 'MeetupIdX', :path => '../mod/MeetupIdX'
|
||||||
|
|
||||||
target 'pesochnicza' do
|
target 'pesochnicza' do
|
||||||
use_frameworks!
|
use_frameworks!
|
||||||
|
|||||||
@@ -2,21 +2,28 @@ PODS:
|
|||||||
- BusX (2023.12.28)
|
- BusX (2023.12.28)
|
||||||
- CordX (2023.12.28):
|
- CordX (2023.12.28):
|
||||||
- BusX
|
- BusX
|
||||||
|
- MeetupIdX (2023.12.28):
|
||||||
|
- BusX
|
||||||
|
- CordX
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- BusX (from `../mod/BusX`)
|
- BusX (from `../mod/BusX`)
|
||||||
- CordX (from `../mod/CordX`)
|
- CordX (from `../mod/CordX`)
|
||||||
|
- MeetupIdX (from `../mod/MeetupIdX`)
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
BusX:
|
BusX:
|
||||||
:path: "../mod/BusX"
|
:path: "../mod/BusX"
|
||||||
CordX:
|
CordX:
|
||||||
:path: "../mod/CordX"
|
:path: "../mod/CordX"
|
||||||
|
MeetupIdX:
|
||||||
|
:path: "../mod/MeetupIdX"
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
BusX: fd22c04ad544d131e66315c1a33d87d85b19712e
|
BusX: fd22c04ad544d131e66315c1a33d87d85b19712e
|
||||||
CordX: 63515d366b217366b9562edcfef34630a7be1171
|
CordX: 63515d366b217366b9562edcfef34630a7be1171
|
||||||
|
MeetupIdX: 2492aa1705abcda355a2a737bc11a36f25f95cf5
|
||||||
|
|
||||||
PODFILE CHECKSUM: 1091fc5c43b2a3881ee63b88848d7ed4f2ede026
|
PODFILE CHECKSUM: 406d6518feb73e67391b746dc455099e031facfa
|
||||||
|
|
||||||
COCOAPODS: 1.13.0
|
COCOAPODS: 1.13.0
|
||||||
|
|||||||
16
mod/MeetupIdX/MeetupIdX.podspec
Normal file
16
mod/MeetupIdX/MeetupIdX.podspec
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
Pod::Spec.new do |s|
|
||||||
|
|
||||||
|
s.name = 'MeetupIdX'
|
||||||
|
s.version = '2023.12.28'
|
||||||
|
s.license = 'IVCS'
|
||||||
|
s.summary = 'Окно ввода ID мероприятия'
|
||||||
|
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'
|
||||||
|
s.dependency 'CordX'
|
||||||
|
|
||||||
|
end
|
||||||
9
mod/MeetupIdX/src/MeetupId.K.swift
Normal file
9
mod/MeetupIdX/src/MeetupId.K.swift
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
public extension MeetupId {
|
||||||
|
enum K: String {
|
||||||
|
case meetupIdIsJoinAvailable
|
||||||
|
case meetupIdJoin
|
||||||
|
case meetupIdTextApp
|
||||||
|
case meetupIdTextUI
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,12 +1,6 @@
|
|||||||
import Combine
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
enum MeetupId {
|
public extension MeetupId {
|
||||||
enum K: String {
|
|
||||||
case meetupIdTextApp
|
|
||||||
case meetupIdTextUI
|
|
||||||
}
|
|
||||||
|
|
||||||
static func onlyAllowJoin(_ s: String) -> Bool? {
|
static func onlyAllowJoin(_ s: String) -> Bool? {
|
||||||
s.hasPrefix("123")
|
s.hasPrefix("123")
|
||||||
}
|
}
|
||||||
@@ -29,14 +23,4 @@ enum MeetupId {
|
|||||||
}
|
}
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Пропускаем лишь значения от UI
|
|
||||||
///
|
|
||||||
/// - Returns: Значение без префиксов "a:"/"u:"
|
|
||||||
func onlyUIText(_ s: String) -> String? {
|
|
||||||
guard s.hasPrefix("u:") else { return nil }
|
|
||||||
return String(s.dropFirst(2))
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
1
mod/MeetupIdX/src/MeetupId.swift
Normal file
1
mod/MeetupIdX/src/MeetupId.swift
Normal file
@@ -0,0 +1 @@
|
|||||||
|
public enum MeetupId { }
|
||||||
40
mod/MeetupIdX/src/V.swift
Normal file
40
mod/MeetupIdX/src/V.swift
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import BusX
|
||||||
|
import CordX
|
||||||
|
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)
|
||||||
|
|
||||||
|
public init() { }
|
||||||
|
|
||||||
|
public var body: some View {
|
||||||
|
VStack {
|
||||||
|
HStack {
|
||||||
|
Text("Check text field:")
|
||||||
|
Text("'\(txtF.value)'")
|
||||||
|
.fontWeight(.bold)
|
||||||
|
}
|
||||||
|
|
||||||
|
TextField("Binding-3", value: $txtF.value, formatter: Cord.TextFieldValueOwner())
|
||||||
|
.padding(8)
|
||||||
|
.border(Color.blue, width: 2)
|
||||||
|
|
||||||
|
Button(action: join.press.send) {
|
||||||
|
Text("Join")
|
||||||
|
.padding(8)
|
||||||
|
.border(
|
||||||
|
isJA.value ? Color.green : Color.gray,
|
||||||
|
width: isJA.value ? 4 : 1
|
||||||
|
)
|
||||||
|
}
|
||||||
|
.disabled(!isJA.value)
|
||||||
|
}
|
||||||
|
.frame(width: 320)
|
||||||
|
.padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import MeetupIdX
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
@UIApplicationMain
|
@UIApplicationMain
|
||||||
@@ -11,7 +12,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate
|
|||||||
) -> Bool {
|
) -> Bool {
|
||||||
window = UIWindow(frame: UIScreen.main.bounds)
|
window = UIWindow(frame: UIScreen.main.bounds)
|
||||||
let vc = UIViewController()
|
let vc = UIViewController()
|
||||||
addSwiftUIViewAsChild(swiftUIView: V(), parent: vc.view)
|
addSwiftUIViewAsChild(swiftUIView: MeetupId.V(), parent: vc.view)
|
||||||
vc.view.backgroundColor = .white
|
vc.view.backgroundColor = .white
|
||||||
window?.rootViewController = vc
|
window?.rootViewController = vc
|
||||||
window?.backgroundColor = UIColor.white
|
window?.backgroundColor = UIColor.white
|
||||||
|
|||||||
36
src/V.swift
36
src/V.swift
@@ -1,36 +0,0 @@
|
|||||||
import BusX
|
|
||||||
import CordX
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct V: View {
|
|
||||||
@StateObject var isJoinAvailable = Cord.Receive("joinAvailable", false)
|
|
||||||
@StateObject var join = Cord.Button("join")
|
|
||||||
@StateObject var textF = Cord.TextField("text.app", "text.ui")
|
|
||||||
let test = Bus.Processor("text.ui", "joinAvailable", MeetupId.onlyAllowJoin)
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
VStack {
|
|
||||||
HStack {
|
|
||||||
Text("Check text field:")
|
|
||||||
Text("'\(textF.value)'")
|
|
||||||
.fontWeight(.bold)
|
|
||||||
}
|
|
||||||
|
|
||||||
TextField("Binding-3", value: $textF.value, formatter: Cord.TextFieldValueOwner())
|
|
||||||
.padding(8)
|
|
||||||
.border(Color.blue, width: 2)
|
|
||||||
|
|
||||||
Button(action: join.press.send) {
|
|
||||||
Text("Join")
|
|
||||||
.padding(8)
|
|
||||||
.border(
|
|
||||||
isJoinAvailable.value ? Color.green : Color.gray,
|
|
||||||
width: isJoinAvailable.value ? 4 : 1
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.disabled(!isJoinAvailable.value)
|
|
||||||
}
|
|
||||||
.frame(width: 320)
|
|
||||||
.padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user