From 04cf2e03cb3cad8e87b391f3820983b3a44c3ae4 Mon Sep 17 00:00:00 2001 From: baegteun Date: Thu, 18 May 2023 09:34:14 +0900 Subject: [PATCH 1/7] :lipstick: :: InputLanguageInfoView --- .../Sources/Scene/InputLanguageInfoView.swift | 58 ++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift b/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift index fd4492ec..44d163e2 100644 --- a/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift +++ b/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift @@ -1,5 +1,7 @@ import BaseFeature +import DesignSystem import SwiftUI +import ViewUtil struct InputLanguageInfoView: View { @StateObject var container: MVIContainer @@ -7,6 +9,60 @@ struct InputLanguageInfoView: View { var state: any InputLanguageInfoStateProtocol { container.model } var body: some View { - Text("Hello, World!") + GeometryReader { proxy in + SMSNavigationTitleView(title: "정보입력") { + Rectangle() + .fill(Color.sms(.neutral(.n10))) + .frame(maxWidth: .infinity) + .frame(height: 16) + + VStack(spacing: 32) { + pageTitleView() + + VStack(spacing: 8) { + languageListView(proxy: proxy) + .titleWrapper("외국어") + .aligned(.leading) + + SMSChip("추가") + .aligned(.leading) + } + } + } + } + } + + @ViewBuilder + func pageTitleView() -> some View { + HStack(spacing: 4) { + Text("외국어") + .foregroundColor(.sms(.system(.black))) + + Text("*") + .foregroundColor(.sms(.sub(.s2))) + + Spacer() + + SMSPageControl(pageCount: 6, selectedPage: 4) + } + .smsFont(.title1) + } + + @ViewBuilder + func languageListView(proxy: GeometryProxy) -> some View { + VStack(spacing: 12) { + ForEach(1..<5, id: \.self) { index in + HStack(spacing: 16) { + SMSTextField("예) 토익", text: .constant("")) + .frame(maxWidth: .infinity) + + SMSTextField("900", text: .constant("")) + .frame(maxWidth: proxy.size.width / 3) + + Image(systemName: "trash") + .frame(width: 24, height: 24) + } + } + } } } From 8c1dedc0a3fba2b3d0ecaa0ff8d664428e42121b Mon Sep 17 00:00:00 2001 From: baegteun Date: Thu, 18 May 2023 09:46:42 +0900 Subject: [PATCH 2/7] =?UTF-8?q?:lipstick:=20::=20=EC=99=B8=EA=B5=AD?= =?UTF-8?q?=EC=96=B4=20=ED=8E=98=EC=9D=B4=EC=A7=80=20ui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Application/NeedleGenerated.swift | 4 ++++ .../DI/InputInformationComponent.swift | 3 +++ .../Sources/Scene/InputInformationView.swift | 7 +++++- .../DI/InputLanguageInfoComponent.swift | 9 ++++++- .../Intent/InputLanguageInfoIntent.swift | 8 ++++++- .../Sources/Scene/InputLanguageInfoView.swift | 24 ++++++++++++++----- 6 files changed, 46 insertions(+), 9 deletions(-) diff --git a/Projects/App/Sources/Application/NeedleGenerated.swift b/Projects/App/Sources/Application/NeedleGenerated.swift index f47985f2..bc7e726e 100644 --- a/Projects/App/Sources/Application/NeedleGenerated.swift +++ b/Projects/App/Sources/Application/NeedleGenerated.swift @@ -140,6 +140,9 @@ private class InputInformationDependency7b32a8e7e8a8f0ab5466Provider: InputInfor var inputMilitaryInfoBuildable: any InputMilitaryInfoBuildable { return appComponent.inputMilitaryInfoBuildable } + var inputLanguageInfoBuildable: any InputLanguageInfoBuildable { + return appComponent.inputLanguageInfoBuildable + } private let appComponent: AppComponent init(appComponent: AppComponent) { self.appComponent = appComponent @@ -239,6 +242,7 @@ extension InputInformationComponent: Registration { keyPathToName[\InputInformationDependency.inputSchoolLifeInfoBuildable] = "inputSchoolLifeInfoBuildable-any InputSchoolListInfoBuildable" keyPathToName[\InputInformationDependency.inputWorkInfoBuildable] = "inputWorkInfoBuildable-any InputWorkInfoBuildable" keyPathToName[\InputInformationDependency.inputMilitaryInfoBuildable] = "inputMilitaryInfoBuildable-any InputMilitaryInfoBuildable" + keyPathToName[\InputInformationDependency.inputLanguageInfoBuildable] = "inputLanguageInfoBuildable-any InputLanguageInfoBuildable" } } extension InputCertificateInfoComponent: Registration { diff --git a/Projects/Feature/InputInformationFeature/Sources/DI/InputInformationComponent.swift b/Projects/Feature/InputInformationFeature/Sources/DI/InputInformationComponent.swift index 40dd919f..51442c1f 100644 --- a/Projects/Feature/InputInformationFeature/Sources/DI/InputInformationComponent.swift +++ b/Projects/Feature/InputInformationFeature/Sources/DI/InputInformationComponent.swift @@ -4,6 +4,7 @@ import InputProfileInfoFeatureInterface import InputSchoolLifeInfoFeatureInterface import InputWorkInfoFeatureInterface import InputMilitaryInfoFeatureInterface +import InputLanguageInfoFeatureInterface import NeedleFoundation import SwiftUI @@ -12,6 +13,7 @@ public protocol InputInformationDependency: Dependency { var inputSchoolLifeInfoBuildable: any InputSchoolListInfoBuildable { get } var inputWorkInfoBuildable: any InputWorkInfoBuildable { get } var inputMilitaryInfoBuildable: any InputMilitaryInfoBuildable { get } + var inputLanguageInfoBuildable: any InputLanguageInfoBuildable { get } } public final class InputInformationComponent: @@ -31,6 +33,7 @@ public final class InputInformationComponent: inputSchoolLifeInfoBuildable: dependency.inputSchoolLifeInfoBuildable, inputWorkInfoBuildable: dependency.inputWorkInfoBuildable, inputMilitaryInfoBuildable: dependency.inputMilitaryInfoBuildable, + inputLanguageInfoBuildable: dependency.inputLanguageInfoBuildable, container: container ) } diff --git a/Projects/Feature/InputInformationFeature/Sources/Scene/InputInformationView.swift b/Projects/Feature/InputInformationFeature/Sources/Scene/InputInformationView.swift index 3f92acf9..a6ec277b 100644 --- a/Projects/Feature/InputInformationFeature/Sources/Scene/InputInformationView.swift +++ b/Projects/Feature/InputInformationFeature/Sources/Scene/InputInformationView.swift @@ -4,6 +4,7 @@ import InputProfileInfoFeatureInterface import InputSchoolLifeInfoFeatureInterface import InputWorkInfoFeatureInterface import InputMilitaryInfoFeatureInterface +import InputLanguageInfoFeatureInterface import SwiftUI import ViewUtil @@ -16,18 +17,21 @@ struct InputInformationView: View { private let inputSchoolLifeInfoBuildable: any InputSchoolListInfoBuildable private let inputWorkInfoBuildable: any InputWorkInfoBuildable private let inputMilitaryInfoBuildable: any InputMilitaryInfoBuildable + private let inputLanguageInfoBuildable: any InputLanguageInfoBuildable init( inputProfileInfoBuildable: any InputProfileInfoBuildable, inputSchoolLifeInfoBuildable: any InputSchoolListInfoBuildable, inputWorkInfoBuildable: any InputWorkInfoBuildable, inputMilitaryInfoBuildable: any InputMilitaryInfoBuildable, + inputLanguageInfoBuildable: any InputLanguageInfoBuildable, container: MVIContainer ) { self.inputProfileInfoBuildable = inputProfileInfoBuildable self.inputSchoolLifeInfoBuildable = inputSchoolLifeInfoBuildable self.inputWorkInfoBuildable = inputWorkInfoBuildable self.inputMilitaryInfoBuildable = inputMilitaryInfoBuildable + self.inputLanguageInfoBuildable = inputLanguageInfoBuildable self._container = StateObject(wrappedValue: container) } @@ -57,7 +61,8 @@ struct InputInformationView: View { Text("A") .tag(InformationPhase.certification) - Text("B") + inputLanguageInfoBuildable.makeView() + .eraseToAnyView() .tag(InformationPhase.language) } .animation(.default, value: state.phase) diff --git a/Projects/Feature/InputLanguageInfoFeature/Sources/DI/InputLanguageInfoComponent.swift b/Projects/Feature/InputLanguageInfoFeature/Sources/DI/InputLanguageInfoComponent.swift index 34edb2d7..c17e5e8e 100644 --- a/Projects/Feature/InputLanguageInfoFeature/Sources/DI/InputLanguageInfoComponent.swift +++ b/Projects/Feature/InputLanguageInfoFeature/Sources/DI/InputLanguageInfoComponent.swift @@ -10,6 +10,13 @@ public final class InputLanguageInfoComponent: InputLanguageInfoBuildable { public func makeView() -> some View { - EmptyView() + let model = InputLanguageInfoModel() + let intent = InputLanguageInfoIntent(model: model) + let container = MVIContainer( + intent: intent as InputLanguageInfoIntentProtocol, + model: model as InputLanguageInfoStateProtocol, + modelChangePublisher: model.objectWillChange + ) + return InputLanguageInfoView(container: container) } } diff --git a/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntent.swift b/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntent.swift index b2e14c88..8ca16942 100644 --- a/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntent.swift +++ b/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntent.swift @@ -1,3 +1,9 @@ import Foundation -final class InputLanguageInfoIntent: InputLanguageInfoIntentProtocol {} +final class InputLanguageInfoIntent: InputLanguageInfoIntentProtocol { + private weak var model: (any InputLanguageInfoActionProtocol)? + + init(model: any InputLanguageInfoActionProtocol) { + self.model = model + } +} diff --git a/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift b/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift index 44d163e2..49a21e5c 100644 --- a/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift +++ b/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift @@ -27,7 +27,19 @@ struct InputLanguageInfoView: View { SMSChip("추가") .aligned(.leading) } + + Spacer() + + HStack(spacing: 8) { + CTAButton(text: "이전", style: .outline) + .frame(maxWidth: proxy.size.width / 3) + + CTAButton(text: "다음") + .frame(maxWidth: .infinity) + } + .padding(.bottom, 32) } + .padding([.top, .horizontal], 20) } } } @@ -37,13 +49,13 @@ struct InputLanguageInfoView: View { HStack(spacing: 4) { Text("외국어") .foregroundColor(.sms(.system(.black))) - + Text("*") .foregroundColor(.sms(.sub(.s2))) - + Spacer() - - SMSPageControl(pageCount: 6, selectedPage: 4) + + SMSPageControl(pageCount: 6, selectedPage: 5) } .smsFont(.title1) } @@ -51,13 +63,13 @@ struct InputLanguageInfoView: View { @ViewBuilder func languageListView(proxy: GeometryProxy) -> some View { VStack(spacing: 12) { - ForEach(1..<5, id: \.self) { index in + ForEach(1..<5, id: \.self) { _ in HStack(spacing: 16) { SMSTextField("예) 토익", text: .constant("")) .frame(maxWidth: .infinity) SMSTextField("900", text: .constant("")) - .frame(maxWidth: proxy.size.width / 3) + .frame(maxWidth: proxy.size.width / 4) Image(systemName: "trash") .frame(width: 24, height: 24) From 7a59b5060d6d17f83c55fa1d4fce9b127613b437 Mon Sep 17 00:00:00 2001 From: baegteun Date: Thu, 18 May 2023 09:55:26 +0900 Subject: [PATCH 3/7] :sparkles: :: LanguageInputModel --- .../Sources/Model/LanguageInputModel.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Projects/Feature/InputLanguageInfoFeature/Sources/Model/LanguageInputModel.swift diff --git a/Projects/Feature/InputLanguageInfoFeature/Sources/Model/LanguageInputModel.swift b/Projects/Feature/InputLanguageInfoFeature/Sources/Model/LanguageInputModel.swift new file mode 100644 index 00000000..c6eefa74 --- /dev/null +++ b/Projects/Feature/InputLanguageInfoFeature/Sources/Model/LanguageInputModel.swift @@ -0,0 +1,11 @@ +import Foundation + +struct LanguageInputModel: Equatable { + let languageName: String + let languageScore: String + + init(languageName: String, languageScore: String) { + self.languageName = languageName + self.languageScore = languageScore + } +} From 7ccd9b79404a134e5e990a2b14a83da91d3b07b4 Mon Sep 17 00:00:00 2001 From: baegteun Date: Thu, 18 May 2023 10:33:58 +0900 Subject: [PATCH 4/7] =?UTF-8?q?:sparkles:=20::=20=EC=99=B8=EA=B5=AD?= =?UTF-8?q?=EC=96=B4=20=EC=A0=95=EB=B3=B4=20=EC=9E=85=EB=A0=A5=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EB=B0=94=EC=9D=B8=EB=94=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Intent/InputLanguageInfoIntent.swift | 16 ++++++++ .../InputLanguageInfoIntentProtocol.swift | 7 +++- .../Model/InputLanguageInfoModel.swift | 37 +++++++++++++++++- .../InputLanguageInfoModelProtocol.swift | 11 +++++- .../Sources/Scene/InputLanguageInfoView.swift | 38 ++++++++++++++----- 5 files changed, 94 insertions(+), 15 deletions(-) diff --git a/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntent.swift b/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntent.swift index 8ca16942..96919b91 100644 --- a/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntent.swift +++ b/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntent.swift @@ -6,4 +6,20 @@ final class InputLanguageInfoIntent: InputLanguageInfoIntentProtocol { init(model: any InputLanguageInfoActionProtocol) { self.model = model } + + func updateLanguageName(name: String, at index: Int) { + model?.updateLanguageName(name: name, at: index) + } + + func updateLanguageScore(score: String, at index: Int) { + model?.updateLanguageScore(score: score, at: index) + } + + func deleteLanguage(at index: Int) { + model?.deleteLanguage(at: index) + } + + func languageAppendButtonDidTap() { + model?.appendLanguage() + } } diff --git a/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntentProtocol.swift b/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntentProtocol.swift index 4104fe25..a940d38d 100644 --- a/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntentProtocol.swift +++ b/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntentProtocol.swift @@ -1,3 +1,8 @@ import Foundation -protocol InputLanguageInfoIntentProtocol {} +protocol InputLanguageInfoIntentProtocol { + func updateLanguageName(name: String, at index: Int) + func updateLanguageScore(score: String, at index: Int) + func deleteLanguage(at index: Int) + func languageAppendButtonDidTap() +} diff --git a/Projects/Feature/InputLanguageInfoFeature/Sources/Model/InputLanguageInfoModel.swift b/Projects/Feature/InputLanguageInfoFeature/Sources/Model/InputLanguageInfoModel.swift index ee965e86..181e2031 100644 --- a/Projects/Feature/InputLanguageInfoFeature/Sources/Model/InputLanguageInfoModel.swift +++ b/Projects/Feature/InputLanguageInfoFeature/Sources/Model/InputLanguageInfoModel.swift @@ -1,5 +1,38 @@ import Foundation +import FoundationUtil -final class InputLanguageInfoModel: ObservableObject, InputLanguageInfoStateProtocol {} +final class InputLanguageInfoModel: ObservableObject, InputLanguageInfoStateProtocol { + @Published var languageList: [LanguageInputModel] = [ + .init(languageName: "", languageScore: "") + ] +} -extension InputLanguageInfoModel: InputLanguageInfoActionProtocol {} +extension InputLanguageInfoModel: InputLanguageInfoActionProtocol { + func updateLanguageName(name: String, at index: Int) { + guard let indexedLanguage = languageList[safe: index] else { return } + let newLanuageInputModel = LanguageInputModel( + languageName: name, + languageScore: indexedLanguage.languageScore + ) + languageList[index] = newLanuageInputModel + } + + func updateLanguageScore(score: String, at index: Int) { + guard let indexedLanguage = languageList[safe: index] else { return } + let newLanuageInputModel = LanguageInputModel( + languageName: indexedLanguage.languageName, + languageScore: score + ) + languageList[index] = newLanuageInputModel + } + + func deleteLanguage(at index: Int) { + languageList.remove(at: index) + } + + func appendLanguage() { + languageList.append( + .init(languageName: "", languageScore: "") + ) + } +} diff --git a/Projects/Feature/InputLanguageInfoFeature/Sources/Model/InputLanguageInfoModelProtocol.swift b/Projects/Feature/InputLanguageInfoFeature/Sources/Model/InputLanguageInfoModelProtocol.swift index 87591af3..bd6694ba 100644 --- a/Projects/Feature/InputLanguageInfoFeature/Sources/Model/InputLanguageInfoModelProtocol.swift +++ b/Projects/Feature/InputLanguageInfoFeature/Sources/Model/InputLanguageInfoModelProtocol.swift @@ -1,5 +1,12 @@ import Foundation -protocol InputLanguageInfoStateProtocol {} +protocol InputLanguageInfoStateProtocol { + var languageList: [LanguageInputModel] { get } +} -protocol InputLanguageInfoActionProtocol: AnyObject {} +protocol InputLanguageInfoActionProtocol: AnyObject { + func updateLanguageName(name: String, at index: Int) + func updateLanguageScore(score: String, at index: Int) + func deleteLanguage(at index: Int) + func appendLanguage() +} diff --git a/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift b/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift index 49a21e5c..e89f3e58 100644 --- a/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift +++ b/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift @@ -1,5 +1,6 @@ import BaseFeature import DesignSystem +import FoundationUtil import SwiftUI import ViewUtil @@ -24,8 +25,10 @@ struct InputLanguageInfoView: View { .titleWrapper("외국어") .aligned(.leading) - SMSChip("추가") - .aligned(.leading) + SMSChip("추가") { + intent.languageAppendButtonDidTap() + } + .aligned(.leading) } Spacer() @@ -33,7 +36,7 @@ struct InputLanguageInfoView: View { HStack(spacing: 8) { CTAButton(text: "이전", style: .outline) .frame(maxWidth: proxy.size.width / 3) - + CTAButton(text: "다음") .frame(maxWidth: .infinity) } @@ -63,16 +66,31 @@ struct InputLanguageInfoView: View { @ViewBuilder func languageListView(proxy: GeometryProxy) -> some View { VStack(spacing: 12) { - ForEach(1..<5, id: \.self) { _ in + ForEach(state.languageList.indices, id: \.self) { index in HStack(spacing: 16) { - SMSTextField("예) 토익", text: .constant("")) - .frame(maxWidth: .infinity) + SMSTextField( + "예) 토익", + text: Binding( + get: { state.languageList[safe: index]?.languageName ?? "" }, + set: { intent.updateLanguageName(name: $0, at: index) } + ) + ) + .frame(maxWidth: .infinity) - SMSTextField("900", text: .constant("")) - .frame(maxWidth: proxy.size.width / 4) + SMSTextField( + "900", + text: Binding( + get: { state.languageList[safe: index]?.languageScore ?? "" }, + set: { intent.updateLanguageScore(score: $0, at: index) } + ) + ) + .frame(maxWidth: proxy.size.width / 4) - Image(systemName: "trash") - .frame(width: 24, height: 24) + Button { + intent.deleteLanguage(at: index) + } label: { + SMSIcon(.trash) + } } } } From 0c21d5f5c7b209f5084a72cf599f4e3fd35b06b7 Mon Sep 17 00:00:00 2001 From: baegteun Date: Thu, 18 May 2023 10:46:39 +0900 Subject: [PATCH 5/7] =?UTF-8?q?:speech=5Fballoon:=20::=20=EB=8B=A4?= =?UTF-8?q?=EC=9D=8C=20->=20=EC=9E=85=EB=A0=A5=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Scene/InputLanguageInfoView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift b/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift index e89f3e58..17dc406d 100644 --- a/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift +++ b/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift @@ -37,7 +37,7 @@ struct InputLanguageInfoView: View { CTAButton(text: "이전", style: .outline) .frame(maxWidth: proxy.size.width / 3) - CTAButton(text: "다음") + CTAButton(text: "입력 완료") .frame(maxWidth: .infinity) } .padding(.bottom, 32) From 64e30e0838e52f13e33a3e2afa71f550b7e260a5 Mon Sep 17 00:00:00 2001 From: baegteun Date: Thu, 18 May 2023 10:53:04 +0900 Subject: [PATCH 6/7] =?UTF-8?q?:dizzy:=20::=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EB=B0=8F=20=EC=82=AD=EC=A0=9C=20=EC=95=A0=EB=8B=88=EB=A9=94?= =?UTF-8?q?=EC=9D=B4=EC=85=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Scene/InputLanguageInfoView.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift b/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift index 17dc406d..e6f28e46 100644 --- a/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift +++ b/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift @@ -30,6 +30,7 @@ struct InputLanguageInfoView: View { } .aligned(.leading) } + .animation(.default, value: state.languageList.count) Spacer() From 585c1092fb8a040be7dc253fa763b2dd4c15c685 Mon Sep 17 00:00:00 2001 From: baegteun Date: Thu, 18 May 2023 11:05:39 +0900 Subject: [PATCH 7/7] =?UTF-8?q?:sparkles:=20::=20=EC=96=B8=EC=96=B4=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EC=9E=85=EB=A0=A5=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20delegate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Intent/InputInformationIntent.swift | 11 +++++++++++ .../Intent/InputInformationIntentProtocol.swift | 4 +++- .../Sources/Scene/InputInformationView.swift | 2 +- .../Interface/InputLanguageDelegate.swift | 4 ++++ .../Interface/InputLanguageInfoBuildable.swift | 2 +- .../Sources/DI/InputLanguageInfoComponent.swift | 4 ++-- .../Sources/Intent/InputLanguageInfoIntent.swift | 16 +++++++++++++++- .../Intent/InputLanguageInfoIntentProtocol.swift | 2 ++ .../Sources/Scene/InputLanguageInfoView.swift | 12 ++++++++---- 9 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 Projects/Feature/InputLanguageInfoFeature/Interface/InputLanguageDelegate.swift diff --git a/Projects/Feature/InputInformationFeature/Sources/Intent/InputInformationIntent.swift b/Projects/Feature/InputInformationFeature/Sources/Intent/InputInformationIntent.swift index f2a4b64f..7f561108 100644 --- a/Projects/Feature/InputInformationFeature/Sources/Intent/InputInformationIntent.swift +++ b/Projects/Feature/InputInformationFeature/Sources/Intent/InputInformationIntent.swift @@ -4,6 +4,7 @@ import InputMilitaryInfoFeatureInterface import InputProfileInfoFeatureInterface import InputSchoolLifeInfoFeatureInterface import InputWorkInfoFeatureInterface +import InputLanguageInfoFeatureInterface final class InputInformationIntent: InputInformationIntentProtocol { private weak var model: (any InputInformationActionProtocol)? @@ -58,3 +59,13 @@ extension InputInformationIntent: InputCertificateDelegate { model?.nextButtonDidTap() } } + +extension InputInformationIntent: InputLanguageDelegate { + func languagePrevButtonDidTap() { + model?.prevButtonDidTap() + } + + func completeToInputLanguage() { + // TODO: 전체 데이터 서버에 송신 + } +} diff --git a/Projects/Feature/InputInformationFeature/Sources/Intent/InputInformationIntentProtocol.swift b/Projects/Feature/InputInformationFeature/Sources/Intent/InputInformationIntentProtocol.swift index f182ad66..74fdc1ff 100644 --- a/Projects/Feature/InputInformationFeature/Sources/Intent/InputInformationIntentProtocol.swift +++ b/Projects/Feature/InputInformationFeature/Sources/Intent/InputInformationIntentProtocol.swift @@ -4,10 +4,12 @@ import InputSchoolLifeInfoFeatureInterface import InputWorkInfoFeatureInterface import InputMilitaryInfoFeatureInterface import InputCertificateInfoFeatureInterface +import InputLanguageInfoFeatureInterface protocol InputInformationIntentProtocol: InputProfileDelegate, InputSchoolLifeDelegate, InputWorkDelegate, InputMilitaryDelegate, - InputCertificateDelegate {} + InputCertificateDelegate, + InputLanguageDelegate {} diff --git a/Projects/Feature/InputInformationFeature/Sources/Scene/InputInformationView.swift b/Projects/Feature/InputInformationFeature/Sources/Scene/InputInformationView.swift index 08b4bb5c..5ae83e21 100644 --- a/Projects/Feature/InputInformationFeature/Sources/Scene/InputInformationView.swift +++ b/Projects/Feature/InputInformationFeature/Sources/Scene/InputInformationView.swift @@ -66,7 +66,7 @@ struct InputInformationView: View { .eraseToAnyView() .tag(InformationPhase.certificate) - inputLanguageInfoBuildable.makeView() + inputLanguageInfoBuildable.makeView(delegate: intent) .eraseToAnyView() .tag(InformationPhase.language) } diff --git a/Projects/Feature/InputLanguageInfoFeature/Interface/InputLanguageDelegate.swift b/Projects/Feature/InputLanguageInfoFeature/Interface/InputLanguageDelegate.swift new file mode 100644 index 00000000..30741a40 --- /dev/null +++ b/Projects/Feature/InputLanguageInfoFeature/Interface/InputLanguageDelegate.swift @@ -0,0 +1,4 @@ +public protocol InputLanguageDelegate: AnyObject { + func languagePrevButtonDidTap() + func completeToInputLanguage() +} diff --git a/Projects/Feature/InputLanguageInfoFeature/Interface/InputLanguageInfoBuildable.swift b/Projects/Feature/InputLanguageInfoFeature/Interface/InputLanguageInfoBuildable.swift index 3984fcc3..b44a6055 100644 --- a/Projects/Feature/InputLanguageInfoFeature/Interface/InputLanguageInfoBuildable.swift +++ b/Projects/Feature/InputLanguageInfoFeature/Interface/InputLanguageInfoBuildable.swift @@ -2,5 +2,5 @@ import SwiftUI public protocol InputLanguageInfoBuildable { associatedtype ViewType: View - func makeView() -> ViewType + func makeView(delegate: InputLanguageDelegate) -> ViewType } diff --git a/Projects/Feature/InputLanguageInfoFeature/Sources/DI/InputLanguageInfoComponent.swift b/Projects/Feature/InputLanguageInfoFeature/Sources/DI/InputLanguageInfoComponent.swift index c17e5e8e..e6a6becf 100644 --- a/Projects/Feature/InputLanguageInfoFeature/Sources/DI/InputLanguageInfoComponent.swift +++ b/Projects/Feature/InputLanguageInfoFeature/Sources/DI/InputLanguageInfoComponent.swift @@ -9,9 +9,9 @@ public final class InputLanguageInfoComponent: Component, InputLanguageInfoBuildable { - public func makeView() -> some View { + public func makeView(delegate: InputLanguageDelegate) -> some View { let model = InputLanguageInfoModel() - let intent = InputLanguageInfoIntent(model: model) + let intent = InputLanguageInfoIntent(model: model, languageDelegate: delegate) let container = MVIContainer( intent: intent as InputLanguageInfoIntentProtocol, model: model as InputLanguageInfoStateProtocol, diff --git a/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntent.swift b/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntent.swift index 96919b91..ce324cc0 100644 --- a/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntent.swift +++ b/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntent.swift @@ -1,10 +1,16 @@ import Foundation +import InputLanguageInfoFeatureInterface final class InputLanguageInfoIntent: InputLanguageInfoIntentProtocol { private weak var model: (any InputLanguageInfoActionProtocol)? + private weak var languageDelegate: (any InputLanguageDelegate)? - init(model: any InputLanguageInfoActionProtocol) { + init( + model: any InputLanguageInfoActionProtocol, + languageDelegate: any InputLanguageDelegate + ) { self.model = model + self.languageDelegate = languageDelegate } func updateLanguageName(name: String, at index: Int) { @@ -22,4 +28,12 @@ final class InputLanguageInfoIntent: InputLanguageInfoIntentProtocol { func languageAppendButtonDidTap() { model?.appendLanguage() } + + func prevButtonDidTap() { + languageDelegate?.languagePrevButtonDidTap() + } + + func completeButtonDidTap() { + languageDelegate?.completeToInputLanguage() + } } diff --git a/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntentProtocol.swift b/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntentProtocol.swift index a940d38d..7f4ed7e8 100644 --- a/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntentProtocol.swift +++ b/Projects/Feature/InputLanguageInfoFeature/Sources/Intent/InputLanguageInfoIntentProtocol.swift @@ -5,4 +5,6 @@ protocol InputLanguageInfoIntentProtocol { func updateLanguageScore(score: String, at index: Int) func deleteLanguage(at index: Int) func languageAppendButtonDidTap() + func prevButtonDidTap() + func completeButtonDidTap() } diff --git a/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift b/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift index e6f28e46..2f8246a3 100644 --- a/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift +++ b/Projects/Feature/InputLanguageInfoFeature/Sources/Scene/InputLanguageInfoView.swift @@ -35,11 +35,15 @@ struct InputLanguageInfoView: View { Spacer() HStack(spacing: 8) { - CTAButton(text: "이전", style: .outline) - .frame(maxWidth: proxy.size.width / 3) + CTAButton(text: "이전", style: .outline) { + intent.prevButtonDidTap() + } + .frame(maxWidth: proxy.size.width / 3) - CTAButton(text: "입력 완료") - .frame(maxWidth: .infinity) + CTAButton(text: "입력 완료") { + intent.completeButtonDidTap() + } + .frame(maxWidth: .infinity) } .padding(.bottom, 32) }