Михаил Капелько 1 year ago
parent
commit
a1ec08f280
9 changed files with 78 additions and 55 deletions
  1. +1
    -0
      app/Podfile
  2. +8
    -1
      app/Podfile.lock
  3. +16
    -0
      mod/MeetupIdX/MeetupIdX.podspec
  4. +9
    -0
      mod/MeetupIdX/src/MeetupId.K.swift
  5. +1
    -17
      mod/MeetupIdX/src/MeetupId.Onlys.swift
  6. +1
    -0
      mod/MeetupIdX/src/MeetupId.swift
  7. +40
    -0
      mod/MeetupIdX/src/V.swift
  8. +2
    -1
      src/App.swift
  9. +0
    -36
      src/V.swift

+ 1
- 0
app/Podfile View File

@@ -5,6 +5,7 @@ platform :ios, '14.0'
# Source.
pod 'BusX', :path => '../mod/BusX'
pod 'CordX', :path => '../mod/CordX'
pod 'MeetupIdX', :path => '../mod/MeetupIdX'

target 'pesochnicza' do
use_frameworks!


+ 8
- 1
app/Podfile.lock View File

@@ -2,21 +2,28 @@ PODS:
- BusX (2023.12.28)
- CordX (2023.12.28):
- BusX
- MeetupIdX (2023.12.28):
- BusX
- CordX

DEPENDENCIES:
- BusX (from `../mod/BusX`)
- CordX (from `../mod/CordX`)
- MeetupIdX (from `../mod/MeetupIdX`)

EXTERNAL SOURCES:
BusX:
:path: "../mod/BusX"
CordX:
:path: "../mod/CordX"
MeetupIdX:
:path: "../mod/MeetupIdX"

SPEC CHECKSUMS:
BusX: fd22c04ad544d131e66315c1a33d87d85b19712e
CordX: 63515d366b217366b9562edcfef34630a7be1171
MeetupIdX: 2492aa1705abcda355a2a737bc11a36f25f95cf5

PODFILE CHECKSUM: 1091fc5c43b2a3881ee63b88848d7ed4f2ede026
PODFILE CHECKSUM: 406d6518feb73e67391b746dc455099e031facfa

COCOAPODS: 1.13.0

+ 16
- 0
mod/MeetupIdX/MeetupIdX.podspec View 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
- 0
mod/MeetupIdX/src/MeetupId.K.swift View File

@@ -0,0 +1,9 @@
public extension MeetupId {
enum K: String {
case meetupIdIsJoinAvailable
case meetupIdJoin
case meetupIdTextApp
case meetupIdTextUI
}
}


src/MeetupId.swift → mod/MeetupIdX/src/MeetupId.Onlys.swift View File

@@ -1,12 +1,6 @@
import Combine
import Foundation

enum MeetupId {
enum K: String {
case meetupIdTextApp
case meetupIdTextUI
}

public extension MeetupId {
static func onlyAllowJoin(_ s: String) -> Bool? {
s.hasPrefix("123")
}
@@ -29,14 +23,4 @@ enum MeetupId {
}
return r
}

/// Пропускаем лишь значения от UI
///
/// - Returns: Значение без префиксов "a:"/"u:"
func onlyUIText(_ s: String) -> String? {
guard s.hasPrefix("u:") else { return nil }
return String(s.dropFirst(2))
}
}



+ 1
- 0
mod/MeetupIdX/src/MeetupId.swift View File

@@ -0,0 +1 @@
public enum MeetupId { }

+ 40
- 0
mod/MeetupIdX/src/V.swift View 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()
}
}
}

+ 2
- 1
src/App.swift View File

@@ -1,3 +1,4 @@
import MeetupIdX
import UIKit

@UIApplicationMain
@@ -11,7 +12,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate
) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
let vc = UIViewController()
addSwiftUIViewAsChild(swiftUIView: V(), parent: vc.view)
addSwiftUIViewAsChild(swiftUIView: MeetupId.V(), parent: vc.view)
vc.view.backgroundColor = .white
window?.rootViewController = vc
window?.backgroundColor = UIColor.white


+ 0
- 36
src/V.swift View File

@@ -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()
}
}

Loading…
Cancel
Save