From 8cd10b105dc6eb7437b7d46da7488d56226097a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Tue, 26 Dec 2023 13:46:31 +0300 Subject: [PATCH] d --- src/App.swift | 2 +- src/MeetupId.yml | 6 ++++++ src/V.swift | 9 ++++++++- src/VM.swift | 2 ++ 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 src/MeetupId.yml diff --git a/src/App.swift b/src/App.swift index f14573c..d4e6caa 100644 --- a/src/App.swift +++ b/src/App.swift @@ -12,7 +12,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate window = UIWindow(frame: UIScreen.main.bounds) let vc = UIViewController() addSwiftUIViewAsChild(swiftUIView: V(), parent: vc.view) - vc.view.backgroundColor = .gray + vc.view.backgroundColor = .white window?.rootViewController = vc window?.backgroundColor = UIColor.white window?.makeKeyAndVisible() diff --git a/src/MeetupId.yml b/src/MeetupId.yml new file mode 100644 index 0000000..adccc4e --- /dev/null +++ b/src/MeetupId.yml @@ -0,0 +1,6 @@ +version: 2 + +model: + textApp: [String, ""] + textUI: [String, ""] + diff --git a/src/V.swift b/src/V.swift index 809fb64..c19f2bb 100644 --- a/src/V.swift +++ b/src/V.swift @@ -13,7 +13,14 @@ struct V: View { TextField("Binding-3", value: $vm.text, formatter: TextFieldValueOwner()) .padding(8) - .border(Color.green, width: 4) + .border(Color.blue, width: 2) + + Button(action: vm.join.send) { + Text("Join") + .padding(8) + .border(vm.isJoinAvailable ? Color.green : Color.red, width: 4) + } + } .frame(width: 320) .padding() diff --git a/src/VM.swift b/src/VM.swift index 0935b5e..5339891 100644 --- a/src/VM.swift +++ b/src/VM.swift @@ -8,6 +8,8 @@ final class VM: ObservableObject { MeetupId.K.meetupIdTextApp.rawValue, MeetupId.onlyFormat ) + var isJoinAvailable = true + let join = PassthroughSubject() var subscriptions = [AnyCancellable]() init() {