Михаил Капелько pirms 10 mēnešiem
vecāks
revīzija
ea09967ab6
13 mainītis faili ar 74 papildinājumiem un 38 dzēšanām
  1. +1
    -0
      app/Podfile
  2. +7
    -1
      app/Podfile.lock
  3. +15
    -0
      mod/CordX/CordX.podspec
  4. +3
    -3
      mod/CordX/src/Cord.Button.swift
  5. +9
    -0
      mod/CordX/src/Cord.Onlys.swift
  6. +3
    -3
      mod/CordX/src/Cord.Receive.swift
  7. +7
    -4
      mod/CordX/src/Cord.TextField.swift
  8. +19
    -0
      mod/CordX/src/Cord.TextFieldValueOwner.swift
  9. +0
    -1
      mod/CordX/src/Cord.swift
  10. +0
    -8
      src/Cord.Aux.swift
  11. +8
    -0
      src/MeetupId.swift
  12. +0
    -17
      src/TextFieldValueOwner.swift
  13. +2
    -1
      src/V.swift

+ 1
- 0
app/Podfile Parādīt failu

@@ -4,6 +4,7 @@ platform :ios, '14.0'

# Source.
pod 'BusX', :path => '../mod/BusX'
pod 'CordX', :path => '../mod/CordX'

target 'pesochnicza' do
use_frameworks!


+ 7
- 1
app/Podfile.lock Parādīt failu

@@ -1,16 +1,22 @@
PODS:
- BusX (2023.12.28)
- CordX (2023.12.28):
- BusX

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

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

SPEC CHECKSUMS:
BusX: fd22c04ad544d131e66315c1a33d87d85b19712e
CordX: 63515d366b217366b9562edcfef34630a7be1171

PODFILE CHECKSUM: c4bbd7cc826ceee472b0bbb53eb2d5dc7dd1f97e
PODFILE CHECKSUM: 1091fc5c43b2a3881ee63b88848d7ed4f2ede026

COCOAPODS: 1.13.0

+ 15
- 0
mod/CordX/CordX.podspec Parādīt failu

@@ -0,0 +1,15 @@
Pod::Spec.new do |s|

s.name = 'CordX'
s.version = '2023.12.28'
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

src/Cord.Button.swift → mod/CordX/src/Cord.Button.swift Parādīt failu

@@ -2,11 +2,11 @@ import BusX
import Combine

extension Cord {
final class Button: ObservableObject {
let press = PassthroughSubject<Void, Never>()
public final class Button: ObservableObject {
public let press = PassthroughSubject<Void, Never>()
var subscriptions = [AnyCancellable]()
init(_ key: String) {
public init(_ key: String) {
Bus.send(
key,
press.eraseToAnyPublisher(),

+ 9
- 0
mod/CordX/src/Cord.Onlys.swift Parādīt failu

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

src/Cord.Receive.swift → mod/CordX/src/Cord.Receive.swift Parādīt failu

@@ -2,11 +2,11 @@ import BusX
import Combine

extension Cord {
final class Receive<T>: ObservableObject {
@Published var value: T
public final class Receive<T>: ObservableObject {
@Published public var value: T
var subscriptions = [AnyCancellable]()
init(
public init(
_ key: String,
_ defaultValue: T
) {

src/Cord.TextField.swift → mod/CordX/src/Cord.TextField.swift Parādīt failu

@@ -3,17 +3,20 @@ import Combine
import SwiftUI

extension Cord {
final class TextField: ObservableObject {
@Published var value = "a:"
public final class TextField: ObservableObject {
@Published public var value = "a:"
var subscriptions = [AnyCancellable]()
init(
public init(
_ textApp: String,
_ textUI: String
) {
Bus.send(
textUI,
$value.removeDuplicates().compactMap(onlyUIText).eraseToAnyPublisher(),
$value
.removeDuplicates()
.compactMap(onlyUIText)
.eraseToAnyPublisher(),
sub: &subscriptions
)

+ 19
- 0
mod/CordX/src/Cord.TextFieldValueOwner.swift Parādīt failu

@@ -0,0 +1,19 @@
import Foundation

extension Cord {
public final class TextFieldValueOwner: Formatter {
public override func string(for obj: Any?) -> String? {
guard let str = obj as? String else { return nil }
return String(str.dropFirst(2))
}

public override func getObjectValue(
_ obj: AutoreleasingUnsafeMutablePointer<AnyObject?>?,
for string: String,
errorDescription error: AutoreleasingUnsafeMutablePointer<NSString?>?
) -> Bool {
obj?.pointee = "u:\(string)" as AnyObject
return true
}
}
}

src/Cord.swift → mod/CordX/src/Cord.swift Parādīt failu

@@ -1,2 +1 @@

public enum Cord { }

+ 0
- 8
src/Cord.Aux.swift Parādīt failu

@@ -1,8 +0,0 @@

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

+ 8
- 0
src/MeetupId.swift Parādīt failu

@@ -29,6 +29,14 @@ 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))
}
}



+ 0
- 17
src/TextFieldValueOwner.swift Parādīt failu

@@ -1,17 +0,0 @@
import Foundation

class TextFieldValueOwner: Formatter {
override func string(for obj: Any?) -> String? {
guard let str = obj as? String else { return nil }
return String(str.dropFirst(2))
}

override func getObjectValue(
_ obj: AutoreleasingUnsafeMutablePointer<AnyObject?>?,
for string: String,
errorDescription error: AutoreleasingUnsafeMutablePointer<NSString?>?
) -> Bool {
obj?.pointee = "u:\(string)" as AnyObject
return true
}
}

+ 2
- 1
src/V.swift Parādīt failu

@@ -1,4 +1,5 @@
import BusX
import CordX
import SwiftUI

struct V: View {
@@ -15,7 +16,7 @@ struct V: View {
.fontWeight(.bold)
}

TextField("Binding-3", value: $textF.value, formatter: TextFieldValueOwner())
TextField("Binding-3", value: $textF.value, formatter: Cord.TextFieldValueOwner())
.padding(8)
.border(Color.blue, width: 2)



Notiek ielāde…
Atcelt
Saglabāt