Михаил Капелько 10 달 전
부모
커밋
95be65e07a
6개의 변경된 파일32개의 추가작업 그리고 25개의 파일을 삭제
  1. +0
    -3
      Modules/MeetupIdX/MeetupId.yml
  2. +1
    -5
      Modules/MeetupIdX/src/MeetupId.Aux.swift
  3. +29
    -0
      Modules/MeetupIdX/src/MeetupId.Formatter.swift
  4. +0
    -16
      Modules/MeetupIdX/src/MeetupId.Generated.swift
  5. +1
    -1
      Modules/MeetupIdX/src/MeetupId.Shoulds.swift
  6. +1
    -0
      Modules/MeetupIdX/src/MeetupId.V.swift

+ 0
- 3
Modules/MeetupIdX/MeetupId.yml 파일 보기

@@ -2,7 +2,6 @@ version: 2

model:
join: [Bool, false]
textApp: [String, ""]
textUI: [String, ""]

service:
@@ -10,10 +9,8 @@ service:
busModel
pipes:
join: [toggle, K.join]
textApp: [recent, K.textApp]
textUI: [recent, K.textUI]

world:
join: [ps]
textApp: [ps]
textUI: [ps]

Modules/MeetupIdX/src/MeetupId.Onlys.swift → Modules/MeetupIdX/src/MeetupId.Aux.swift 파일 보기

@@ -1,11 +1,7 @@
import Foundation

public extension MeetupId {
static func onlyAllowJoin(_ s: String) -> Bool? {
s.hasPrefix("123")
}

static func onlyFormat(_ s: String) -> String? {
static func formatId(_ s: String) -> String? {
let digits = s.components(separatedBy: NSCharacterSet.decimalDigits.inverted).reduce("") { $0 + $1 }
var r = ""
var i = 0

+ 29
- 0
Modules/MeetupIdX/src/MeetupId.Formatter.swift 파일 보기

@@ -0,0 +1,29 @@
import BusX
import Combine

extension MeetupId {
final class Formatter: ObservableObject {
let text = PassthroughSubject<String, Never>()
var subscriptions = [AnyCancellable]()

init(
_ src: String,
_ dst: String
) {
Bus.receive(
[src],
{ [weak self] _, v in self?.text.send(v) },
sub: &subscriptions
)

Bus.send(
dst,
text
.debounce(for: .seconds(0.2), scheduler: DispatchQueue.main)
.compactMap(formatId)
.eraseToAnyPublisher(),
sub: &subscriptions
)
}
}
}

+ 0
- 16
Modules/MeetupIdX/src/MeetupId.Generated.swift 파일 보기

@@ -13,7 +13,6 @@ import UIKit

public protocol MeetupIdContext {
var join: Bool { get }
var textApp: MPAK.Recent<String> { get }
var textUI: MPAK.Recent<String> { get }
}

@@ -36,7 +35,6 @@ extension MeetupId {

public struct Model: MeetupIdContext {
public var join: Bool = false
public var textApp: MPAK.Recent<String> = .init("")
public var textUI: MPAK.Recent<String> = .init("")
}

@@ -60,7 +58,6 @@ extension MeetupId {

public struct World {
let join = PassthroughSubject<Void, Never>()
let textApp = PassthroughSubject<String, Never>()
let textUI = PassthroughSubject<String, Never>()

public init(
@@ -103,19 +100,6 @@ extension MeetupId {



ctrl.pipeValue(
dbg: "textA",
sub: nil,
Bus.events.compactMap { Bus.convertKeyValue(K.textApp, $0) }.map { (k: String, v: String) in v }.eraseToAnyPublisher(),
{
$0.textApp.value = $1
$0.textApp.isRecent = true
},
{ m, _ in m.textApp.isRecent = false }
)



ctrl.pipeValue(
dbg: "textUI",
sub: nil,


+ 1
- 1
Modules/MeetupIdX/src/MeetupId.Shoulds.swift 파일 보기

@@ -4,7 +4,7 @@ public extension MeetupId {
static func shouldEnableJoin(_ c: MeetupIdContext) -> Bool? {
if
c.textUI.isRecent,
let sid = onlyFormat(c.textUI.value)
let sid = formatId(c.textUI.value)
{
return sid.count > 2
}


+ 1
- 0
Modules/MeetupIdX/src/MeetupId.V.swift 파일 보기

@@ -4,6 +4,7 @@ import SwiftUI

extension MeetupId {
public struct V: View {
@StateObject var fmt = MeetupId.Formatter(K.textUI, K.textApp)
@StateObject var isJA = Cord.Receive(K.isJoinAvailable, false)
@StateObject var join = Cord.Button(K.join)
@StateObject var txtF = Cord.TextField(K.textApp, K.textUI)


불러오는 중...
취소
저장