From 717cf948778ef73e97164deb188dddbe3cfbc0f4 Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Thu, 3 Nov 2022 22:31:02 +0900 Subject: [PATCH 01/17] =?UTF-8?q?feat=20::=20tabbar=EC=97=90=20=EA=B0=81?= =?UTF-8?q?=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Application/NeedleGenerated.swift | 12 ++++++++++ .../Sources/MainTabComponent.swift | 11 ++++++++- .../MainTabFeature/Sources/MainTabView.swift | 24 +++++++++++++++---- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/Projects/App/Sources/Application/NeedleGenerated.swift b/Projects/App/Sources/Application/NeedleGenerated.swift index 8141eee0..073b3619 100644 --- a/Projects/App/Sources/Application/NeedleGenerated.swift +++ b/Projects/App/Sources/Application/NeedleGenerated.swift @@ -166,6 +166,15 @@ private class MainTabDependency2826cdb310ed0b17a725Provider: MainTabDependency { var homeComponent: HomeComponent { return appComponent.homeComponent } + var applyComponent: ApplyComponent { + return appComponent.applyComponent + } + var noticeComponent: NoticeComponent { + return appComponent.noticeComponent + } + var myPageComponent: MyPageComponent { + return appComponent.myPageComponent + } private let appComponent: AppComponent init(appComponent: AppComponent) { self.appComponent = appComponent @@ -430,6 +439,9 @@ extension SignupProfileImageComponent: Registration { extension MainTabComponent: Registration { public func registerItems() { keyPathToName[\MainTabDependency.homeComponent] = "homeComponent-HomeComponent" + keyPathToName[\MainTabDependency.applyComponent] = "applyComponent-ApplyComponent" + keyPathToName[\MainTabDependency.noticeComponent] = "noticeComponent-NoticeComponent" + keyPathToName[\MainTabDependency.myPageComponent] = "myPageComponent-MyPageComponent" } } extension MyPageComponent: Registration { diff --git a/Projects/Features/MainTabFeature/Sources/MainTabComponent.swift b/Projects/Features/MainTabFeature/Sources/MainTabComponent.swift index f82a074e..347787e5 100644 --- a/Projects/Features/MainTabFeature/Sources/MainTabComponent.swift +++ b/Projects/Features/MainTabFeature/Sources/MainTabComponent.swift @@ -1,15 +1,24 @@ import NeedleFoundation import SwiftUI import HomeFeature +import ApplyFeature +import NoticeFeature +import MyPageFeature public protocol MainTabDependency: Dependency { var homeComponent: HomeComponent { get } + var applyComponent: ApplyComponent { get } + var noticeComponent: NoticeComponent { get } + var myPageComponent: MyPageComponent { get } } public final class MainTabComponent: Component { public func makeView() -> some View { MainTabView( - homeComponent: dependency.homeComponent + homeComponent: dependency.homeComponent, + applyComponent: dependency.applyComponent, + noticeComponent: dependency.noticeComponent, + myPageComponent: dependency.myPageComponent ) } } diff --git a/Projects/Features/MainTabFeature/Sources/MainTabView.swift b/Projects/Features/MainTabFeature/Sources/MainTabView.swift index f801ecd5..203d8696 100644 --- a/Projects/Features/MainTabFeature/Sources/MainTabView.swift +++ b/Projects/Features/MainTabFeature/Sources/MainTabView.swift @@ -1,7 +1,10 @@ import SwiftUI -import DesignSystem import HomeFeature +import ApplyFeature +import NoticeFeature +import MyPageFeature import BaseFeature +import DesignSystem import Utility enum TabFlow: Int { @@ -15,9 +18,20 @@ struct MainTabView: View { @State var tabbarHidden = false private let homeComponent: HomeComponent + private let applyComponent: ApplyComponent + private let noticeComponent: NoticeComponent + private let myPageComponent: MyPageComponent - init(homeComponent: HomeComponent) { + init( + homeComponent: HomeComponent, + applyComponent: ApplyComponent, + noticeComponent: NoticeComponent, + myPageComponent: MyPageComponent + ) { self.homeComponent = homeComponent + self.applyComponent = applyComponent + self.noticeComponent = noticeComponent + self.myPageComponent = myPageComponent } var body: some View { @@ -26,13 +40,13 @@ struct MainTabView: View { homeComponent.makeView() .tag(TabFlow.home) - Text("1") + applyComponent.makeView() .tag(TabFlow.apply) - Text("2") + noticeComponent.makeView() .tag(TabFlow.notice) - Text("3") + myPageComponent.makeView() .tag(TabFlow.myPage) } .environment(\.tabbarHidden, $tabbarHidden) From 34a0d1d2fb1ee73b265133d59714185b1106aa13 Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Fri, 4 Nov 2022 14:04:28 +0900 Subject: [PATCH 02/17] =?UTF-8?q?feat=20::=20NoticeViewModel=EC=97=90=20?= =?UTF-8?q?=EB=93=A4=EC=96=B4=EA=B0=80=EC=95=BC=20=ED=95=A0=20=EB=8D=94?= =?UTF-8?q?=EB=AF=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NoticeFeature/Sources/NoticeList.swift | 16 ++++++++++++++++ .../NoticeFeature/Sources/NoticeViewModel.swift | 9 +++++++++ 2 files changed, 25 insertions(+) create mode 100644 Projects/Features/NoticeFeature/Sources/NoticeList.swift diff --git a/Projects/Features/NoticeFeature/Sources/NoticeList.swift b/Projects/Features/NoticeFeature/Sources/NoticeList.swift new file mode 100644 index 00000000..16261f13 --- /dev/null +++ b/Projects/Features/NoticeFeature/Sources/NoticeList.swift @@ -0,0 +1,16 @@ +// 임시입니다. + +import Foundation + +struct NoticeList { + init( + title: String, + contentz: String + ) { + self.title = title + self.contentz = contentz + } + + let title: String + let contentz: String +} diff --git a/Projects/Features/NoticeFeature/Sources/NoticeViewModel.swift b/Projects/Features/NoticeFeature/Sources/NoticeViewModel.swift index f3a9cb01..86759ece 100644 --- a/Projects/Features/NoticeFeature/Sources/NoticeViewModel.swift +++ b/Projects/Features/NoticeFeature/Sources/NoticeViewModel.swift @@ -2,4 +2,13 @@ import BaseFeature import Combine final class NoticeViewModel: BaseViewModel { + @Published var noticeList: [NoticeList] = [ + NoticeList(title: "11월 기숙사 봉사 관련 안내입니다", contentz: "2022/11/01"), + NoticeList(title: "10월 상점 제도 변경되었습니다", contentz: "2022/10/11"), + NoticeList(title: "지금부터 라면을 허용합니다.", contentz: "2022/10/01"), + NoticeList(title: "11월 기숙사 봉사 관련 안내입니다", contentz: "2022/11/01"), + NoticeList(title: "10월 상점 제도 변경되었습니다", contentz: "2022/10/11"), + NoticeList(title: "지금부터 라면을 허용합니다.", contentz: "2022/10/01"), + NoticeList(title: "DMS 새롭게 업데이트 될 예정입니다", contentz: "2022/09/21") + ] } From 5d107e2c648b1fae93c27484dda21c50e2cce519 Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Fri, 4 Nov 2022 14:08:01 +0900 Subject: [PATCH 03/17] feat :: NoticeOrderButton --- .../Sources/NoticeOrderButton.swift | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Projects/Features/NoticeFeature/Sources/NoticeOrderButton.swift diff --git a/Projects/Features/NoticeFeature/Sources/NoticeOrderButton.swift b/Projects/Features/NoticeFeature/Sources/NoticeOrderButton.swift new file mode 100644 index 00000000..2b5fdda1 --- /dev/null +++ b/Projects/Features/NoticeFeature/Sources/NoticeOrderButton.swift @@ -0,0 +1,57 @@ +import SwiftUI + +public struct NoticeOrderButton: View { + var text: String + var color: Color + var action: () -> Void + + public init( + text: String = "", + color: Color = .blue, + action: @escaping () -> Void = {} + ) { + self.text = text + self.color = color + self.action = action + } + + public var body: some View { + Button(action: action) { + Text(text) + } + .buttonStyle(NoticeOrderButtonStyle()) + } +} + +public struct NoticeOrderButtonStyle: ButtonStyle { + public func makeBody(configuration: Configuration) -> some View { + return AnyView(OutlinedButton(configuration: configuration, color: .GrayScale.gray6)) + } +} + +// MARK: - Outlined +extension NoticeOrderButtonStyle { + struct OutlinedButton: View { + let configuration: ButtonStyle.Configuration + let color: Color + @Environment(\.isEnabled) private var isEnabled: Bool + + var body: some View { + configuration.label + .padding(.vertical, 8.5) + .padding(.horizontal, 16) + .dmsFont(.button(.default)) + .background(.clear) + .foregroundColor(color) + .overlay { + RoundedRectangle(cornerRadius: 5) + .stroke(color, lineWidth: 1) + } + .opacity( + isEnabled ? + configuration.isPressed ? 0.7 : 1.0 : + 0.5 + ) + } + } +} From 97d7aac894d3aea074a81d78e6aa7ad718f69723 Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Sat, 5 Nov 2022 17:44:15 +0900 Subject: [PATCH 04/17] =?UTF-8?q?feat=20::=20NoticeListView=20UI=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NoticeFeature/Sources/NoticeView.swift | 57 ++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/Projects/Features/NoticeFeature/Sources/NoticeView.swift b/Projects/Features/NoticeFeature/Sources/NoticeView.swift index 8bea0f10..ef1b59c5 100644 --- a/Projects/Features/NoticeFeature/Sources/NoticeView.swift +++ b/Projects/Features/NoticeFeature/Sources/NoticeView.swift @@ -3,6 +3,7 @@ import SwiftUI struct NoticeView: View { @StateObject var viewModel: NoticeViewModel + @State var isNavigateSignup = false init( viewModel: NoticeViewModel @@ -11,6 +12,60 @@ struct NoticeView: View { } var body: some View { - Text("Text") + NavigationView { + VStack { + HStack { + Spacer() + + NoticeOrderButton(text: "최신순", color: .GrayScale.gray6) + .padding(.horizontal, 24) + } + .padding(.top, 12) + + ScrollView { + VStack { + Spacer() + .frame(height: 10) + + ForEach(viewModel.noticeList, id: \.self) { noticeList in + noticeListCellView( + title: noticeList.title, + content: noticeList.content + ) + .padding(.top, 5) + .listRowInsets(EdgeInsets()) + + } + } + .padding(.horizontal, 24) + + } + } + .navigationTitle("공지") + .navigationBarTitleDisplayMode(.inline) + } + } + + @ViewBuilder + func noticeListCellView(title: String, content: String) -> some View { + ZStack { + Color.System.surface + .cornerRadius(6) + + HStack { + VStack(alignment: .leading) { + Text(title) + .dmsFont(.text(.medium), color: .System.title) + + Text(content) + .dmsFont(.text(.extraSmall), color: .System.text) + } + Spacer() + } + .padding(.horizontal, 16) + } + .frame(height: 68) + .shadow(color: .GrayScale.gray5.opacity(0.15), blur: 20) + } } From 1e412eb91b30304df993ee6acf9fadfe1bf34d84 Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Sat, 5 Nov 2022 17:45:34 +0900 Subject: [PATCH 05/17] =?UTF-8?q?feat=20::=20NoticeListView=20=EC=A3=BC?= =?UTF-8?q?=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/Features/NoticeFeature/Sources/NoticeComponent.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Projects/Features/NoticeFeature/Sources/NoticeComponent.swift b/Projects/Features/NoticeFeature/Sources/NoticeComponent.swift index 8f47f1cd..c0a810ef 100644 --- a/Projects/Features/NoticeFeature/Sources/NoticeComponent.swift +++ b/Projects/Features/NoticeFeature/Sources/NoticeComponent.swift @@ -5,7 +5,6 @@ public protocol NoticeDependency: Dependency {} public final class NoticeComponent: Component { public func makeView() -> some View { - Text("Text") + NoticeView(viewModel: NoticeViewModel()) } } - From 3e3e83c8288d345e20b3e07554149f61a20778c6 Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Sat, 5 Nov 2022 17:45:45 +0900 Subject: [PATCH 06/17] =?UTF-8?q?chore=20::=20=EC=9E=90=EC=9E=98=ED=95=9C?= =?UTF-8?q?=20=EC=9D=B4=EC=8A=88=EB=93=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NoticeFeature/Sources/NoticeList.swift | 10 ++++---- .../Sources/NoticeViewModel.swift | 24 +++++++++++++------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Projects/Features/NoticeFeature/Sources/NoticeList.swift b/Projects/Features/NoticeFeature/Sources/NoticeList.swift index 16261f13..9cef56e5 100644 --- a/Projects/Features/NoticeFeature/Sources/NoticeList.swift +++ b/Projects/Features/NoticeFeature/Sources/NoticeList.swift @@ -2,15 +2,15 @@ import Foundation -struct NoticeList { +struct NoticeList: Hashable { init( title: String, - contentz: String + content: String ) { self.title = title - self.contentz = contentz + self.content = content } - let title: String - let contentz: String + var title: String + var content: String } diff --git a/Projects/Features/NoticeFeature/Sources/NoticeViewModel.swift b/Projects/Features/NoticeFeature/Sources/NoticeViewModel.swift index 86759ece..fec5dd85 100644 --- a/Projects/Features/NoticeFeature/Sources/NoticeViewModel.swift +++ b/Projects/Features/NoticeFeature/Sources/NoticeViewModel.swift @@ -3,12 +3,22 @@ import Combine final class NoticeViewModel: BaseViewModel { @Published var noticeList: [NoticeList] = [ - NoticeList(title: "11월 기숙사 봉사 관련 안내입니다", contentz: "2022/11/01"), - NoticeList(title: "10월 상점 제도 변경되었습니다", contentz: "2022/10/11"), - NoticeList(title: "지금부터 라면을 허용합니다.", contentz: "2022/10/01"), - NoticeList(title: "11월 기숙사 봉사 관련 안내입니다", contentz: "2022/11/01"), - NoticeList(title: "10월 상점 제도 변경되었습니다", contentz: "2022/10/11"), - NoticeList(title: "지금부터 라면을 허용합니다.", contentz: "2022/10/01"), - NoticeList(title: "DMS 새롭게 업데이트 될 예정입니다", contentz: "2022/09/21") + NoticeList(title: "11월 기숙사 봉사 관련 안내입니다", content: "2022/11/01"), + NoticeList(title: "10월 상점 제도 변경되었습니다", content: "2022/10/11"), + NoticeList(title: "지금부터 라면을 허용합니다.", content: "2022/10/01"), + NoticeList(title: "11월 기숙사 봉사 관련 안내입니다", content: "2022/11/01"), + NoticeList(title: "10월 상점 제도 변경되었습니다", content: "2022/10/11"), + NoticeList(title: "지금부터 라면을 허용합니다.", content: "2022/10/01"), + NoticeList(title: "10월 상점 제도 변경되었습니다", content: "2022/10/11"), + NoticeList(title: "지금부터 라면을 허용합니다.", content: "2022/10/01"), + NoticeList(title: "11월 기숙사 봉사 관련 안내입니다", content: "2022/11/01"), + NoticeList(title: "10월 상점 제도 변경되었습니다", content: "2022/10/11"), + NoticeList(title: "지금부터 라면을 허용합니다.", content: "2022/10/01"), + NoticeList(title: "10월 상점 제도 변경되었습니다", content: "2022/10/11"), + NoticeList(title: "지금부터 라면을 허용합니다.", content: "2022/10/01"), + NoticeList(title: "11월 기숙사 봉사 관련 안내입니다", content: "2022/11/01"), + NoticeList(title: "10월 상점 제도 변경되었습니다", content: "2022/10/11"), + NoticeList(title: "지금부터 라면을 허용합니다.", content: "2022/10/01"), + NoticeList(title: "DMS 새롭게 업데이트 될 예정입니다", content: "2022/09/21") ] } From 2cb10b96781f159d49f512eeb8cd6e8f718247e8 Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Sat, 5 Nov 2022 23:41:29 +0900 Subject: [PATCH 07/17] feat :: needle --- .../Sources/Application/NeedleGenerated.swift | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Projects/App/Sources/Application/NeedleGenerated.swift b/Projects/App/Sources/Application/NeedleGenerated.swift index e3f0a870..cb5f6f3b 100644 --- a/Projects/App/Sources/Application/NeedleGenerated.swift +++ b/Projects/App/Sources/Application/NeedleGenerated.swift @@ -306,15 +306,17 @@ private func factory359a960501e79e833f64f47b58f8f304c97af4d5(_ component: Needle return EnterInformationDependency9204f24c784151f429ddProvider(appComponent: parent1(component) as! AppComponent) } private class NoticeDependencyaec92ef53617a421bdf3Provider: NoticeDependency { - - - init() { - + var fetchNoticeListUseCase: any FetchNoticeListUseCase { + return appComponent.fetchNoticeListUseCase + } + private let appComponent: AppComponent + init(appComponent: AppComponent) { + self.appComponent = appComponent } } /// ^->AppComponent->NoticeComponent -private func factoryaf8e5665e5b9217918f5e3b0c44298fc1c149afb(_ component: NeedleFoundation.Scope) -> AnyObject { - return NoticeDependencyaec92ef53617a421bdf3Provider() +private func factoryaf8e5665e5b9217918f5f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { + return NoticeDependencyaec92ef53617a421bdf3Provider(appComponent: parent1(component) as! AppComponent) } private class FindIDDependencyb481fe947a844cc29913Provider: FindIDDependency { var findIDUseCase: any FindIDUseCase { @@ -498,7 +500,7 @@ extension EnterInformationComponent: Registration { } extension NoticeComponent: Registration { public func registerItems() { - + keyPathToName[\NoticeDependency.fetchNoticeListUseCase] = "fetchNoticeListUseCase-any FetchNoticeListUseCase" } } extension FindIDComponent: Registration { @@ -541,7 +543,7 @@ private func register1() { registerProviderFactory("^->AppComponent->AuthenticationEmailComponent", factory8798d0becd9d2870112af47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->ChangePasswordComponent", factoryab7c4d87dab53e0a51b9f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->EnterInformationComponent", factory359a960501e79e833f64f47b58f8f304c97af4d5) - registerProviderFactory("^->AppComponent->NoticeComponent", factoryaf8e5665e5b9217918f5e3b0c44298fc1c149afb) + registerProviderFactory("^->AppComponent->NoticeComponent", factoryaf8e5665e5b9217918f5f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->FindIDComponent", factory8dd2f9e0b545ead35ecaf47b58f8f304c97af4d5) } #endif From 74594c50dce930316aa2c6e136eab341c6ed8486 Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Sat, 5 Nov 2022 23:41:50 +0900 Subject: [PATCH 08/17] feat :: Ruthless Launcher --- .../NoticeFeature/Sources/NoticeComponent.swift | 13 ++++++++++--- .../NoticeFeature/Sources/NoticeOrderButton.swift | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Projects/Features/NoticeFeature/Sources/NoticeComponent.swift b/Projects/Features/NoticeFeature/Sources/NoticeComponent.swift index c0a810ef..58d91a9d 100644 --- a/Projects/Features/NoticeFeature/Sources/NoticeComponent.swift +++ b/Projects/Features/NoticeFeature/Sources/NoticeComponent.swift @@ -1,10 +1,17 @@ -import SwiftUI +import DomainModule import NeedleFoundation +import SwiftUI -public protocol NoticeDependency: Dependency {} +public protocol NoticeDependency: Dependency { + var fetchNoticeListUseCase: any FetchNoticeListUseCase { get } +} public final class NoticeComponent: Component { public func makeView() -> some View { - NoticeView(viewModel: NoticeViewModel()) + NoticeView( + viewModel: .init( + fetchNoticeListUseCase: dependency.fetchNoticeListUseCase + ) + ) } } diff --git a/Projects/Features/NoticeFeature/Sources/NoticeOrderButton.swift b/Projects/Features/NoticeFeature/Sources/NoticeOrderButton.swift index 2b5fdda1..20b8e28c 100644 --- a/Projects/Features/NoticeFeature/Sources/NoticeOrderButton.swift +++ b/Projects/Features/NoticeFeature/Sources/NoticeOrderButton.swift @@ -1,4 +1,5 @@ import SwiftUI +import DesignSystem public struct NoticeOrderButton: View { var text: String From baab9f3ce10b8353450d21ceffe3ff128db963ce Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Sun, 6 Nov 2022 23:55:09 +0900 Subject: [PATCH 09/17] delete :: NoticeList --- .../NoticeFeature/Sources/NoticeList.swift | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 Projects/Features/NoticeFeature/Sources/NoticeList.swift diff --git a/Projects/Features/NoticeFeature/Sources/NoticeList.swift b/Projects/Features/NoticeFeature/Sources/NoticeList.swift deleted file mode 100644 index 9cef56e5..00000000 --- a/Projects/Features/NoticeFeature/Sources/NoticeList.swift +++ /dev/null @@ -1,16 +0,0 @@ -// 임시입니다. - -import Foundation - -struct NoticeList: Hashable { - init( - title: String, - content: String - ) { - self.title = title - self.content = content - } - - var title: String - var content: String -} From fbb46c520d3ab9626f0c224fbc41a6c558809199 Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Sun, 6 Nov 2022 23:56:10 +0900 Subject: [PATCH 10/17] =?UTF-8?q?rename=20::=20NoticeView=EB=A5=BC=20Notic?= =?UTF-8?q?eListView?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Application/DI/AppComponent.swift | 4 ++-- .../Sources/Application/NeedleGenerated.swift | 18 +++++++++--------- .../Sources/MainTabComponent.swift | 2 +- .../MainTabFeature/Sources/MainTabView.swift | 4 ++-- ...mponent.swift => NoticeListComponent.swift} | 4 ++-- .../{NoticeView.swift => NoticeListView.swift} | 12 +++++++----- 6 files changed, 23 insertions(+), 21 deletions(-) rename Projects/Features/NoticeFeature/Sources/{NoticeComponent.swift => NoticeListComponent.swift} (79%) rename Projects/Features/NoticeFeature/Sources/{NoticeView.swift => NoticeListView.swift} (81%) diff --git a/Projects/App/Sources/Application/DI/AppComponent.swift b/Projects/App/Sources/Application/DI/AppComponent.swift index 979eb0de..7d60cf3f 100644 --- a/Projects/App/Sources/Application/DI/AppComponent.swift +++ b/Projects/App/Sources/Application/DI/AppComponent.swift @@ -82,8 +82,8 @@ public extension AppComponent { var applyComponent: ApplyComponent { ApplyComponent(parent: self) } - var noticeComponent: NoticeComponent { - NoticeComponent(parent: self) + var noticeComponent: NoticeListComponent { + NoticeListComponent(parent: self) } var myPageComponent: MyPageComponent { MyPageComponent(parent: self) diff --git a/Projects/App/Sources/Application/NeedleGenerated.swift b/Projects/App/Sources/Application/NeedleGenerated.swift index cb5f6f3b..62e18042 100644 --- a/Projects/App/Sources/Application/NeedleGenerated.swift +++ b/Projects/App/Sources/Application/NeedleGenerated.swift @@ -169,7 +169,7 @@ private class MainTabDependency2826cdb310ed0b17a725Provider: MainTabDependency { var applyComponent: ApplyComponent { return appComponent.applyComponent } - var noticeComponent: NoticeComponent { + var noticeComponent: NoticeListComponent { return appComponent.noticeComponent } var myPageComponent: MyPageComponent { @@ -305,7 +305,7 @@ private class EnterInformationDependency9204f24c784151f429ddProvider: EnterInfor private func factory359a960501e79e833f64f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { return EnterInformationDependency9204f24c784151f429ddProvider(appComponent: parent1(component) as! AppComponent) } -private class NoticeDependencyaec92ef53617a421bdf3Provider: NoticeDependency { +private class NoticeDependency0e93eb53be8626c408e4Provider: NoticeDependency { var fetchNoticeListUseCase: any FetchNoticeListUseCase { return appComponent.fetchNoticeListUseCase } @@ -314,9 +314,9 @@ private class NoticeDependencyaec92ef53617a421bdf3Provider: NoticeDependency { self.appComponent = appComponent } } -/// ^->AppComponent->NoticeComponent -private func factoryaf8e5665e5b9217918f5f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { - return NoticeDependencyaec92ef53617a421bdf3Provider(appComponent: parent1(component) as! AppComponent) +/// ^->AppComponent->NoticeListComponent +private func factory2ff025b7b4896593c80af47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { + return NoticeDependency0e93eb53be8626c408e4Provider(appComponent: parent1(component) as! AppComponent) } private class FindIDDependencyb481fe947a844cc29913Provider: FindIDDependency { var findIDUseCase: any FindIDUseCase { @@ -364,7 +364,7 @@ extension AppComponent: Registration { localTable["mainTabComponent-MainTabComponent"] = { self.mainTabComponent as Any } localTable["homeComponent-HomeComponent"] = { self.homeComponent as Any } localTable["applyComponent-ApplyComponent"] = { self.applyComponent as Any } - localTable["noticeComponent-NoticeComponent"] = { self.noticeComponent as Any } + localTable["noticeComponent-NoticeListComponent"] = { self.noticeComponent as Any } localTable["myPageComponent-MyPageComponent"] = { self.myPageComponent as Any } localTable["remoteNoticeDataSource-any RemoteNoticeDataSource"] = { self.remoteNoticeDataSource as Any } localTable["noticeRepository-any NoticeRepository"] = { self.noticeRepository as Any } @@ -447,7 +447,7 @@ extension MainTabComponent: Registration { public func registerItems() { keyPathToName[\MainTabDependency.homeComponent] = "homeComponent-HomeComponent" keyPathToName[\MainTabDependency.applyComponent] = "applyComponent-ApplyComponent" - keyPathToName[\MainTabDependency.noticeComponent] = "noticeComponent-NoticeComponent" + keyPathToName[\MainTabDependency.noticeComponent] = "noticeComponent-NoticeListComponent" keyPathToName[\MainTabDependency.myPageComponent] = "myPageComponent-MyPageComponent" } } @@ -498,7 +498,7 @@ extension EnterInformationComponent: Registration { keyPathToName[\EnterInformationDependency.authenticationEmailComponent] = "authenticationEmailComponent-AuthenticationEmailComponent" } } -extension NoticeComponent: Registration { +extension NoticeListComponent: Registration { public func registerItems() { keyPathToName[\NoticeDependency.fetchNoticeListUseCase] = "fetchNoticeListUseCase-any FetchNoticeListUseCase" } @@ -543,7 +543,7 @@ private func register1() { registerProviderFactory("^->AppComponent->AuthenticationEmailComponent", factory8798d0becd9d2870112af47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->ChangePasswordComponent", factoryab7c4d87dab53e0a51b9f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->EnterInformationComponent", factory359a960501e79e833f64f47b58f8f304c97af4d5) - registerProviderFactory("^->AppComponent->NoticeComponent", factoryaf8e5665e5b9217918f5f47b58f8f304c97af4d5) + registerProviderFactory("^->AppComponent->NoticeListComponent", factory2ff025b7b4896593c80af47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->FindIDComponent", factory8dd2f9e0b545ead35ecaf47b58f8f304c97af4d5) } #endif diff --git a/Projects/Features/MainTabFeature/Sources/MainTabComponent.swift b/Projects/Features/MainTabFeature/Sources/MainTabComponent.swift index 347787e5..6a8ffeea 100644 --- a/Projects/Features/MainTabFeature/Sources/MainTabComponent.swift +++ b/Projects/Features/MainTabFeature/Sources/MainTabComponent.swift @@ -8,7 +8,7 @@ import MyPageFeature public protocol MainTabDependency: Dependency { var homeComponent: HomeComponent { get } var applyComponent: ApplyComponent { get } - var noticeComponent: NoticeComponent { get } + var noticeComponent: NoticeListComponent { get } var myPageComponent: MyPageComponent { get } } diff --git a/Projects/Features/MainTabFeature/Sources/MainTabView.swift b/Projects/Features/MainTabFeature/Sources/MainTabView.swift index 203d8696..55d74b8f 100644 --- a/Projects/Features/MainTabFeature/Sources/MainTabView.swift +++ b/Projects/Features/MainTabFeature/Sources/MainTabView.swift @@ -19,13 +19,13 @@ struct MainTabView: View { private let homeComponent: HomeComponent private let applyComponent: ApplyComponent - private let noticeComponent: NoticeComponent + private let noticeComponent: NoticeListComponent private let myPageComponent: MyPageComponent init( homeComponent: HomeComponent, applyComponent: ApplyComponent, - noticeComponent: NoticeComponent, + noticeComponent: NoticeListComponent, myPageComponent: MyPageComponent ) { self.homeComponent = homeComponent diff --git a/Projects/Features/NoticeFeature/Sources/NoticeComponent.swift b/Projects/Features/NoticeFeature/Sources/NoticeListComponent.swift similarity index 79% rename from Projects/Features/NoticeFeature/Sources/NoticeComponent.swift rename to Projects/Features/NoticeFeature/Sources/NoticeListComponent.swift index 58d91a9d..fee44b9a 100644 --- a/Projects/Features/NoticeFeature/Sources/NoticeComponent.swift +++ b/Projects/Features/NoticeFeature/Sources/NoticeListComponent.swift @@ -6,9 +6,9 @@ public protocol NoticeDependency: Dependency { var fetchNoticeListUseCase: any FetchNoticeListUseCase { get } } -public final class NoticeComponent: Component { +public final class NoticeListComponent: Component { public func makeView() -> some View { - NoticeView( + NoticeListView( viewModel: .init( fetchNoticeListUseCase: dependency.fetchNoticeListUseCase ) diff --git a/Projects/Features/NoticeFeature/Sources/NoticeView.swift b/Projects/Features/NoticeFeature/Sources/NoticeListView.swift similarity index 81% rename from Projects/Features/NoticeFeature/Sources/NoticeView.swift rename to Projects/Features/NoticeFeature/Sources/NoticeListView.swift index ef1b59c5..cb38ac70 100644 --- a/Projects/Features/NoticeFeature/Sources/NoticeView.swift +++ b/Projects/Features/NoticeFeature/Sources/NoticeListView.swift @@ -1,12 +1,12 @@ import DesignSystem import SwiftUI -struct NoticeView: View { - @StateObject var viewModel: NoticeViewModel +struct NoticeListView: View { + @StateObject var viewModel: NoticeListViewModel @State var isNavigateSignup = false init( - viewModel: NoticeViewModel + viewModel: NoticeListViewModel ) { _viewModel = StateObject(wrappedValue: viewModel) } @@ -17,7 +17,9 @@ struct NoticeView: View { HStack { Spacer() - NoticeOrderButton(text: "최신순", color: .GrayScale.gray6) + NoticeOrderButton(text: viewModel.orderTypeButtonName, color: .GrayScale.gray6) { + viewModel.orderTypeButtonDidTap() + } .padding(.horizontal, 24) } .padding(.top, 12) @@ -30,7 +32,7 @@ struct NoticeView: View { ForEach(viewModel.noticeList, id: \.self) { noticeList in noticeListCellView( title: noticeList.title, - content: noticeList.content + content: viewModel.dateToString(date: noticeList.createdAt) ) .padding(.top, 5) .listRowInsets(EdgeInsets()) From 14560ad46d5ccb5348c5ba8a55d688c539924e7c Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Sun, 6 Nov 2022 23:56:26 +0900 Subject: [PATCH 11/17] =?UTF-8?q?feat=20::=20NoticeEntity=20Hashable=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/DomainModule/Sources/Entities/NoticeEntity.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/Services/DomainModule/Sources/Entities/NoticeEntity.swift b/Projects/Services/DomainModule/Sources/Entities/NoticeEntity.swift index eed0fccd..7d19f73b 100644 --- a/Projects/Services/DomainModule/Sources/Entities/NoticeEntity.swift +++ b/Projects/Services/DomainModule/Sources/Entities/NoticeEntity.swift @@ -1,6 +1,6 @@ import Foundation -public struct NoticeEntity: Equatable { +public struct NoticeEntity: Equatable, Hashable { public init(id: String, title: String, createdAt: Date) { self.id = id self.title = title From 550f393c3745a6e5252ca2e58e71e793197d0c1a Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Sun, 6 Nov 2022 23:56:44 +0900 Subject: [PATCH 12/17] feat :: NoticeListViewModel --- .../Sources/NoticeListViewModel.swift | 51 +++++++++++++++++++ .../Sources/NoticeViewModel.swift | 24 --------- 2 files changed, 51 insertions(+), 24 deletions(-) create mode 100644 Projects/Features/NoticeFeature/Sources/NoticeListViewModel.swift delete mode 100644 Projects/Features/NoticeFeature/Sources/NoticeViewModel.swift diff --git a/Projects/Features/NoticeFeature/Sources/NoticeListViewModel.swift b/Projects/Features/NoticeFeature/Sources/NoticeListViewModel.swift new file mode 100644 index 00000000..fe7aff9a --- /dev/null +++ b/Projects/Features/NoticeFeature/Sources/NoticeListViewModel.swift @@ -0,0 +1,51 @@ +import BaseFeature +import Foundation +import DomainModule +import ErrorModule +import Combine +import DataMappingModule + +final class NoticeListViewModel: BaseViewModel { + @Published var noticeList: [NoticeEntity] = [] + @Published var noticeOrderType: NoticeOrderType = .new + @Published var orderTypeButtonName: String = "최신순" + + private let fetchNoticeListUseCase: any FetchNoticeListUseCase + + init( + fetchNoticeListUseCase: any FetchNoticeListUseCase + ) { + self.fetchNoticeListUseCase = fetchNoticeListUseCase + super.init() + fetchNoticeList() + } + + func fetchNoticeList() { + addCancellable( + fetchNoticeListUseCase.execute( + order: noticeOrderType + ) + ) { [weak self] noticeList in + self?.noticeList = noticeList + } + } + + func orderTypeButtonDidTap() { + if noticeOrderType == .new { + self.noticeOrderType = .old + self.orderTypeButtonName = "오래된순" + fetchNoticeList() + } else if noticeOrderType == .old { + self.noticeOrderType = .new + self.orderTypeButtonName = "최신순" + fetchNoticeList() + } + } + + func dateToString(date: Date) -> String { + let dateFomatter = DateFormatter() + dateFomatter.dateFormat = "yyyy-MM-dd" + return dateFomatter.string(from: date) + } + +} diff --git a/Projects/Features/NoticeFeature/Sources/NoticeViewModel.swift b/Projects/Features/NoticeFeature/Sources/NoticeViewModel.swift deleted file mode 100644 index fec5dd85..00000000 --- a/Projects/Features/NoticeFeature/Sources/NoticeViewModel.swift +++ /dev/null @@ -1,24 +0,0 @@ -import BaseFeature -import Combine - -final class NoticeViewModel: BaseViewModel { - @Published var noticeList: [NoticeList] = [ - NoticeList(title: "11월 기숙사 봉사 관련 안내입니다", content: "2022/11/01"), - NoticeList(title: "10월 상점 제도 변경되었습니다", content: "2022/10/11"), - NoticeList(title: "지금부터 라면을 허용합니다.", content: "2022/10/01"), - NoticeList(title: "11월 기숙사 봉사 관련 안내입니다", content: "2022/11/01"), - NoticeList(title: "10월 상점 제도 변경되었습니다", content: "2022/10/11"), - NoticeList(title: "지금부터 라면을 허용합니다.", content: "2022/10/01"), - NoticeList(title: "10월 상점 제도 변경되었습니다", content: "2022/10/11"), - NoticeList(title: "지금부터 라면을 허용합니다.", content: "2022/10/01"), - NoticeList(title: "11월 기숙사 봉사 관련 안내입니다", content: "2022/11/01"), - NoticeList(title: "10월 상점 제도 변경되었습니다", content: "2022/10/11"), - NoticeList(title: "지금부터 라면을 허용합니다.", content: "2022/10/01"), - NoticeList(title: "10월 상점 제도 변경되었습니다", content: "2022/10/11"), - NoticeList(title: "지금부터 라면을 허용합니다.", content: "2022/10/01"), - NoticeList(title: "11월 기숙사 봉사 관련 안내입니다", content: "2022/11/01"), - NoticeList(title: "10월 상점 제도 변경되었습니다", content: "2022/10/11"), - NoticeList(title: "지금부터 라면을 허용합니다.", content: "2022/10/01"), - NoticeList(title: "DMS 새롭게 업데이트 될 예정입니다", content: "2022/09/21") - ] -} From cf817fb1736292453d3a8c1be9bdf687e97807f5 Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Mon, 7 Nov 2022 00:00:35 +0900 Subject: [PATCH 13/17] =?UTF-8?q?feat=20::=20NoticeList=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=95=88=EC=9C=BC=EB=A1=9C=20=EC=9C=84=EC=B9=98=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/{ => NoticeList}/NoticeListComponent.swift | 0 .../NoticeFeature/Sources/{ => NoticeList}/NoticeListView.swift | 0 .../Sources/{ => NoticeList}/NoticeListViewModel.swift | 0 .../Sources/{ => NoticeList}/NoticeOrderButton.swift | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename Projects/Features/NoticeFeature/Sources/{ => NoticeList}/NoticeListComponent.swift (100%) rename Projects/Features/NoticeFeature/Sources/{ => NoticeList}/NoticeListView.swift (100%) rename Projects/Features/NoticeFeature/Sources/{ => NoticeList}/NoticeListViewModel.swift (100%) rename Projects/Features/NoticeFeature/Sources/{ => NoticeList}/NoticeOrderButton.swift (100%) diff --git a/Projects/Features/NoticeFeature/Sources/NoticeListComponent.swift b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListComponent.swift similarity index 100% rename from Projects/Features/NoticeFeature/Sources/NoticeListComponent.swift rename to Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListComponent.swift diff --git a/Projects/Features/NoticeFeature/Sources/NoticeListView.swift b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListView.swift similarity index 100% rename from Projects/Features/NoticeFeature/Sources/NoticeListView.swift rename to Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListView.swift diff --git a/Projects/Features/NoticeFeature/Sources/NoticeListViewModel.swift b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListViewModel.swift similarity index 100% rename from Projects/Features/NoticeFeature/Sources/NoticeListViewModel.swift rename to Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListViewModel.swift diff --git a/Projects/Features/NoticeFeature/Sources/NoticeOrderButton.swift b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeOrderButton.swift similarity index 100% rename from Projects/Features/NoticeFeature/Sources/NoticeOrderButton.swift rename to Projects/Features/NoticeFeature/Sources/NoticeList/NoticeOrderButton.swift From 74696d521f1250919da2da0067262f1c549f2390 Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Mon, 7 Nov 2022 09:58:45 +0900 Subject: [PATCH 14/17] =?UTF-8?q?feat=20::=20date=20=EB=B0=98=ED=99=98?= =?UTF-8?q?=ED=95=98=EB=8A=94=EA=B1=B0=20toSmallDMSDateString=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NoticeFeature/Sources/NoticeList/NoticeListView.swift | 4 ++-- .../Sources/NoticeList/NoticeListViewModel.swift | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListView.swift b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListView.swift index cb38ac70..01642f7c 100644 --- a/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListView.swift +++ b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListView.swift @@ -1,9 +1,9 @@ import DesignSystem +import Utility import SwiftUI struct NoticeListView: View { @StateObject var viewModel: NoticeListViewModel - @State var isNavigateSignup = false init( viewModel: NoticeListViewModel @@ -32,7 +32,7 @@ struct NoticeListView: View { ForEach(viewModel.noticeList, id: \.self) { noticeList in noticeListCellView( title: noticeList.title, - content: viewModel.dateToString(date: noticeList.createdAt) + content: noticeList.createdAt.toSmallDMSDateString() ) .padding(.top, 5) .listRowInsets(EdgeInsets()) diff --git a/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListViewModel.swift b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListViewModel.swift index fe7aff9a..8a3e0d51 100644 --- a/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListViewModel.swift +++ b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListViewModel.swift @@ -41,11 +41,4 @@ final class NoticeListViewModel: BaseViewModel { fetchNoticeList() } } - - func dateToString(date: Date) -> String { - let dateFomatter = DateFormatter() - dateFomatter.dateFormat = "yyyy-MM-dd" - return dateFomatter.string(from: date) - } - } From 669e444d9124fb064e375231b2708c68bf631a3c Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Mon, 7 Nov 2022 10:01:39 +0900 Subject: [PATCH 15/17] =?UTF-8?q?feat=20::=20DI=20=EC=97=90=20noticeListCo?= =?UTF-8?q?mponent=20=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD=ED=95=98?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/App/Sources/Application/DI/AppComponent.swift | 2 +- Projects/App/Sources/Application/NeedleGenerated.swift | 8 ++++---- .../MainTabFeature/Sources/MainTabComponent.swift | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Projects/App/Sources/Application/DI/AppComponent.swift b/Projects/App/Sources/Application/DI/AppComponent.swift index 7d60cf3f..cd3ec4d4 100644 --- a/Projects/App/Sources/Application/DI/AppComponent.swift +++ b/Projects/App/Sources/Application/DI/AppComponent.swift @@ -82,7 +82,7 @@ public extension AppComponent { var applyComponent: ApplyComponent { ApplyComponent(parent: self) } - var noticeComponent: NoticeListComponent { + var noticeListComponent: NoticeListComponent { NoticeListComponent(parent: self) } var myPageComponent: MyPageComponent { diff --git a/Projects/App/Sources/Application/NeedleGenerated.swift b/Projects/App/Sources/Application/NeedleGenerated.swift index 62e18042..00c900a7 100644 --- a/Projects/App/Sources/Application/NeedleGenerated.swift +++ b/Projects/App/Sources/Application/NeedleGenerated.swift @@ -169,8 +169,8 @@ private class MainTabDependency2826cdb310ed0b17a725Provider: MainTabDependency { var applyComponent: ApplyComponent { return appComponent.applyComponent } - var noticeComponent: NoticeListComponent { - return appComponent.noticeComponent + var noticeListComponent: NoticeListComponent { + return appComponent.noticeListComponent } var myPageComponent: MyPageComponent { return appComponent.myPageComponent @@ -364,7 +364,7 @@ extension AppComponent: Registration { localTable["mainTabComponent-MainTabComponent"] = { self.mainTabComponent as Any } localTable["homeComponent-HomeComponent"] = { self.homeComponent as Any } localTable["applyComponent-ApplyComponent"] = { self.applyComponent as Any } - localTable["noticeComponent-NoticeListComponent"] = { self.noticeComponent as Any } + localTable["noticeListComponent-NoticeListComponent"] = { self.noticeListComponent as Any } localTable["myPageComponent-MyPageComponent"] = { self.myPageComponent as Any } localTable["remoteNoticeDataSource-any RemoteNoticeDataSource"] = { self.remoteNoticeDataSource as Any } localTable["noticeRepository-any NoticeRepository"] = { self.noticeRepository as Any } @@ -447,7 +447,7 @@ extension MainTabComponent: Registration { public func registerItems() { keyPathToName[\MainTabDependency.homeComponent] = "homeComponent-HomeComponent" keyPathToName[\MainTabDependency.applyComponent] = "applyComponent-ApplyComponent" - keyPathToName[\MainTabDependency.noticeComponent] = "noticeComponent-NoticeListComponent" + keyPathToName[\MainTabDependency.noticeListComponent] = "noticeListComponent-NoticeListComponent" keyPathToName[\MainTabDependency.myPageComponent] = "myPageComponent-MyPageComponent" } } diff --git a/Projects/Features/MainTabFeature/Sources/MainTabComponent.swift b/Projects/Features/MainTabFeature/Sources/MainTabComponent.swift index 6a8ffeea..c3e5b3da 100644 --- a/Projects/Features/MainTabFeature/Sources/MainTabComponent.swift +++ b/Projects/Features/MainTabFeature/Sources/MainTabComponent.swift @@ -8,7 +8,7 @@ import MyPageFeature public protocol MainTabDependency: Dependency { var homeComponent: HomeComponent { get } var applyComponent: ApplyComponent { get } - var noticeComponent: NoticeListComponent { get } + var noticeListComponent: NoticeListComponent { get } var myPageComponent: MyPageComponent { get } } @@ -17,7 +17,7 @@ public final class MainTabComponent: Component { MainTabView( homeComponent: dependency.homeComponent, applyComponent: dependency.applyComponent, - noticeComponent: dependency.noticeComponent, + noticeComponent: dependency.noticeListComponent, myPageComponent: dependency.myPageComponent ) } From 76006e3aafaf6cfd7a0882893d7f93efd615ec78 Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Mon, 7 Nov 2022 10:10:11 +0900 Subject: [PATCH 16/17] =?UTF-8?q?feat=20::=20=EC=9D=B4=EB=A6=84=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EC=95=88=EB=90=9C=EA=B1=B0=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20+=20Needle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/App/Sources/Application/NeedleGenerated.swift | 4 ++-- .../Sources/NoticeList/NoticeListComponent.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Projects/App/Sources/Application/NeedleGenerated.swift b/Projects/App/Sources/Application/NeedleGenerated.swift index 00c900a7..281f0740 100644 --- a/Projects/App/Sources/Application/NeedleGenerated.swift +++ b/Projects/App/Sources/Application/NeedleGenerated.swift @@ -305,7 +305,7 @@ private class EnterInformationDependency9204f24c784151f429ddProvider: EnterInfor private func factory359a960501e79e833f64f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { return EnterInformationDependency9204f24c784151f429ddProvider(appComponent: parent1(component) as! AppComponent) } -private class NoticeDependency0e93eb53be8626c408e4Provider: NoticeDependency { +private class NoticeDependency0e93eb53be8626c408e4Provider: NoticeListDependency { var fetchNoticeListUseCase: any FetchNoticeListUseCase { return appComponent.fetchNoticeListUseCase } @@ -500,7 +500,7 @@ extension EnterInformationComponent: Registration { } extension NoticeListComponent: Registration { public func registerItems() { - keyPathToName[\NoticeDependency.fetchNoticeListUseCase] = "fetchNoticeListUseCase-any FetchNoticeListUseCase" + keyPathToName[\NoticeListDependency.fetchNoticeListUseCase] = "fetchNoticeListUseCase-any FetchNoticeListUseCase" } } extension FindIDComponent: Registration { diff --git a/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListComponent.swift b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListComponent.swift index fee44b9a..e1ce6342 100644 --- a/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListComponent.swift +++ b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListComponent.swift @@ -2,11 +2,11 @@ import DomainModule import NeedleFoundation import SwiftUI -public protocol NoticeDependency: Dependency { +public protocol NoticeListDependency: Dependency { var fetchNoticeListUseCase: any FetchNoticeListUseCase { get } } -public final class NoticeListComponent: Component { +public final class NoticeListComponent: Component { public func makeView() -> some View { NoticeListView( viewModel: .init( From 190985dcd12cdcceb029cdae3c79a0d4da998ed7 Mon Sep 17 00:00:00 2001 From: Daehee Kim <0824dh@naver.com> Date: Mon, 7 Nov 2022 16:20:40 +0900 Subject: [PATCH 17/17] feat :: NoticeOrderType --- .../App/Sources/Application/NeedleGenerated.swift | 8 ++++---- .../Sources/NoticeList/NoticeListView.swift | 2 +- .../Sources/NoticeList/NoticeListViewModel.swift | 12 ++---------- .../Sources/Base/NoticeOrderType.swift | 9 +++++++++ 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Projects/App/Sources/Application/NeedleGenerated.swift b/Projects/App/Sources/Application/NeedleGenerated.swift index 281f0740..150b0c1d 100644 --- a/Projects/App/Sources/Application/NeedleGenerated.swift +++ b/Projects/App/Sources/Application/NeedleGenerated.swift @@ -305,7 +305,7 @@ private class EnterInformationDependency9204f24c784151f429ddProvider: EnterInfor private func factory359a960501e79e833f64f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { return EnterInformationDependency9204f24c784151f429ddProvider(appComponent: parent1(component) as! AppComponent) } -private class NoticeDependency0e93eb53be8626c408e4Provider: NoticeListDependency { +private class NoticeListDependency0e93eb53be8626c408e4Provider: NoticeListDependency { var fetchNoticeListUseCase: any FetchNoticeListUseCase { return appComponent.fetchNoticeListUseCase } @@ -315,8 +315,8 @@ private class NoticeDependency0e93eb53be8626c408e4Provider: NoticeListDependency } } /// ^->AppComponent->NoticeListComponent -private func factory2ff025b7b4896593c80af47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { - return NoticeDependency0e93eb53be8626c408e4Provider(appComponent: parent1(component) as! AppComponent) +private func factorye14e687c08985bdffcd0f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { + return NoticeListDependency0e93eb53be8626c408e4Provider(appComponent: parent1(component) as! AppComponent) } private class FindIDDependencyb481fe947a844cc29913Provider: FindIDDependency { var findIDUseCase: any FindIDUseCase { @@ -543,7 +543,7 @@ private func register1() { registerProviderFactory("^->AppComponent->AuthenticationEmailComponent", factory8798d0becd9d2870112af47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->ChangePasswordComponent", factoryab7c4d87dab53e0a51b9f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->EnterInformationComponent", factory359a960501e79e833f64f47b58f8f304c97af4d5) - registerProviderFactory("^->AppComponent->NoticeListComponent", factory2ff025b7b4896593c80af47b58f8f304c97af4d5) + registerProviderFactory("^->AppComponent->NoticeListComponent", factorye14e687c08985bdffcd0f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->FindIDComponent", factory8dd2f9e0b545ead35ecaf47b58f8f304c97af4d5) } #endif diff --git a/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListView.swift b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListView.swift index 01642f7c..99c9009e 100644 --- a/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListView.swift +++ b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListView.swift @@ -17,7 +17,7 @@ struct NoticeListView: View { HStack { Spacer() - NoticeOrderButton(text: viewModel.orderTypeButtonName, color: .GrayScale.gray6) { + NoticeOrderButton(text: viewModel.noticeOrderType.display, color: .GrayScale.gray6) { viewModel.orderTypeButtonDidTap() } .padding(.horizontal, 24) diff --git a/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListViewModel.swift b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListViewModel.swift index 8a3e0d51..1475fd9e 100644 --- a/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListViewModel.swift +++ b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListViewModel.swift @@ -8,7 +8,6 @@ import DataMappingModule final class NoticeListViewModel: BaseViewModel { @Published var noticeList: [NoticeEntity] = [] @Published var noticeOrderType: NoticeOrderType = .new - @Published var orderTypeButtonName: String = "최신순" private let fetchNoticeListUseCase: any FetchNoticeListUseCase @@ -31,14 +30,7 @@ final class NoticeListViewModel: BaseViewModel { } func orderTypeButtonDidTap() { - if noticeOrderType == .new { - self.noticeOrderType = .old - self.orderTypeButtonName = "오래된순" - fetchNoticeList() - } else if noticeOrderType == .old { - self.noticeOrderType = .new - self.orderTypeButtonName = "최신순" - fetchNoticeList() - } + self.noticeOrderType = noticeOrderType == .new ? .old : .new + fetchNoticeList() } } diff --git a/Projects/Services/DataMappingModule/Sources/Base/NoticeOrderType.swift b/Projects/Services/DataMappingModule/Sources/Base/NoticeOrderType.swift index ee9854fe..0101b558 100644 --- a/Projects/Services/DataMappingModule/Sources/Base/NoticeOrderType.swift +++ b/Projects/Services/DataMappingModule/Sources/Base/NoticeOrderType.swift @@ -3,4 +3,13 @@ import Foundation public enum NoticeOrderType: String, Codable { case new = "NEW" case old = "OLD" + + public var display: String { + switch self { + case .new: + return "최신순" + case .old: + return "오래된순" + } + } }