diff --git a/App/Sources/Application/DI/AppComponent.swift b/App/Sources/Application/DI/AppComponent.swift index 22f755e..39b09eb 100644 --- a/App/Sources/Application/DI/AppComponent.swift +++ b/App/Sources/Application/DI/AppComponent.swift @@ -54,4 +54,24 @@ public extension AppComponent { var eventDetailFactory: any EventDetailFactory { EventDetailComponent(parent: self) } + + var editBookOrderFactory: any EditBookOrderFactory { + EditBookOrderComponent(parent: self) + } + + var goalReadingFactory: any GoalReadingFactory { + GoalReadingComponent(parent: self) + } + + var bookDetailFactory: any BookDetailFactory { + BookDetailComponent(parent: self) + } + + var bookPostFactory: any BookPostFactory { + BookPostComponent(parent: self) + } + + var editBookFactory: any EditBookFactory { + EditBookComponent(parent: self) + } } diff --git a/App/Sources/Application/NeedleGenerated.swift b/App/Sources/Application/NeedleGenerated.swift index 64ef6ea..411fa70 100644 --- a/App/Sources/Application/NeedleGenerated.swift +++ b/App/Sources/Application/NeedleGenerated.swift @@ -30,10 +30,29 @@ private class EventDependency7c44a7ba678fce8bee09Provider: EventDependency { private func factory59c5e0d7ceb1b46b5a25f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { return EventDependency7c44a7ba678fce8bee09Provider(appComponent: parent1(component) as! AppComponent) } +private class GoalReadingDependencye2592b9f2070897fea4aProvider: GoalReadingDependency { + var bookDetailFactory: any BookDetailFactory { + return appComponent.bookDetailFactory + } + var bookPostFactory: any BookPostFactory { + return appComponent.bookPostFactory + } + private let appComponent: AppComponent + init(appComponent: AppComponent) { + self.appComponent = appComponent + } +} +/// ^->AppComponent->GoalReadingComponent +private func factory64ab00ae624edb5fc801f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { + return GoalReadingDependencye2592b9f2070897fea4aProvider(appComponent: parent1(component) as! AppComponent) +} private class MyPageDependency48d84b530313b3ee40feProvider: MyPageDependency { var mindwayIntroduceFactory: any MindwayIntroduceFactory { return appComponent.mindwayIntroduceFactory } + var editBookOrderFactory: any EditBookOrderFactory { + return appComponent.editBookOrderFactory + } private let appComponent: AppComponent init(appComponent: AppComponent) { self.appComponent = appComponent @@ -43,16 +62,29 @@ private class MyPageDependency48d84b530313b3ee40feProvider: MyPageDependency { private func factory0f6f456ebf157d02dfb3f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { return MyPageDependency48d84b530313b3ee40feProvider(appComponent: parent1(component) as! AppComponent) } -private class MainDependency7c6a5b4738b211b8e155Provider: MainDependency { +private class BookPostDependencyf1a1072299f5d75ca9e4Provider: BookPostDependency { init() { } } +/// ^->AppComponent->BookPostComponent +private func factoryb66a93c7baaaea754546e3b0c44298fc1c149afb(_ component: NeedleFoundation.Scope) -> AnyObject { + return BookPostDependencyf1a1072299f5d75ca9e4Provider() +} +private class MainDependency7c6a5b4738b211b8e155Provider: MainDependency { + var goalReadingFactory: any GoalReadingFactory { + return appComponent.goalReadingFactory + } + private let appComponent: AppComponent + init(appComponent: AppComponent) { + self.appComponent = appComponent + } +} /// ^->AppComponent->MainComponent -private func factoryc9274e46e78e70f29c54e3b0c44298fc1c149afb(_ component: NeedleFoundation.Scope) -> AnyObject { - return MainDependency7c6a5b4738b211b8e155Provider() +private func factoryc9274e46e78e70f29c54f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { + return MainDependency7c6a5b4738b211b8e155Provider(appComponent: parent1(component) as! AppComponent) } private class MindwayIntroduceDependencyc4365ffea3250f49d853Provider: MindwayIntroduceDependency { var myPageFactory: any MyPageFactory { @@ -118,6 +150,17 @@ private class SigninDependencyde06a9d0b22764487733Provider: SigninDependency { private func factory2882a056d84a613debccf47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { return SigninDependencyde06a9d0b22764487733Provider(appComponent: parent1(component) as! AppComponent) } +private class EditBookDependencye4edce91232b58cd274cProvider: EditBookDependency { + + + init() { + + } +} +/// ^->AppComponent->EditBookComponent +private func factory50d6bb212becd2bdda91e3b0c44298fc1c149afb(_ component: NeedleFoundation.Scope) -> AnyObject { + return EditBookDependencye4edce91232b58cd274cProvider() +} private class RecommendBookDependency7cd1f82e68cef9855fcdProvider: RecommendBookDependency { var bookOrderFactory: any BookOrderFactory { return appComponent.bookOrderFactory @@ -157,6 +200,30 @@ private class EventDetailDependencya414c017c6a5e1011982Provider: EventDetailDepe private func factory8610907cee92bde36225f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { return EventDetailDependencya414c017c6a5e1011982Provider(appComponent: parent1(component) as! AppComponent) } +private class BookDetailDependencyd37af1bbd6f48cbfe0ceProvider: BookDetailDependency { + var editBookFactory: any EditBookFactory { + return appComponent.editBookFactory + } + private let appComponent: AppComponent + init(appComponent: AppComponent) { + self.appComponent = appComponent + } +} +/// ^->AppComponent->BookDetailComponent +private func factory7813ba428cd9266b6527f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { + return BookDetailDependencyd37af1bbd6f48cbfe0ceProvider(appComponent: parent1(component) as! AppComponent) +} +private class EditBookOrderDependencyd9c4ca2bacf94e3839d0Provider: EditBookOrderDependency { + + + init() { + + } +} +/// ^->AppComponent->EditBookOrderComponent +private func factory656219adf97836b74cc2e3b0c44298fc1c149afb(_ component: NeedleFoundation.Scope) -> AnyObject { + return EditBookOrderDependencyd9c4ca2bacf94e3839d0Provider() +} #else extension EventComponent: Registration { @@ -164,16 +231,28 @@ extension EventComponent: Registration { keyPathToName[\EventDependency.eventDetailFactory] = "eventDetailFactory-any EventDetailFactory" } } +extension GoalReadingComponent: Registration { + public func registerItems() { + keyPathToName[\GoalReadingDependency.bookDetailFactory] = "bookDetailFactory-any BookDetailFactory" + keyPathToName[\GoalReadingDependency.bookPostFactory] = "bookPostFactory-any BookPostFactory" + } +} extension MyPageComponent: Registration { public func registerItems() { keyPathToName[\MyPageDependency.mindwayIntroduceFactory] = "mindwayIntroduceFactory-any MindwayIntroduceFactory" + keyPathToName[\MyPageDependency.editBookOrderFactory] = "editBookOrderFactory-any EditBookOrderFactory" } } -extension MainComponent: Registration { +extension BookPostComponent: Registration { public func registerItems() { } } +extension MainComponent: Registration { + public func registerItems() { + keyPathToName[\MainDependency.goalReadingFactory] = "goalReadingFactory-any GoalReadingFactory" + } +} extension MindwayIntroduceComponent: Registration { public func registerItems() { keyPathToName[\MindwayIntroduceDependency.myPageFactory] = "myPageFactory-any MyPageFactory" @@ -198,6 +277,11 @@ extension SigninComponent: Registration { keyPathToName[\SigninDependency.loginUseCase] = "loginUseCase-any LoginUseCase" } } +extension EditBookComponent: Registration { + public func registerItems() { + + } +} extension RecommendBookComponent: Registration { public func registerItems() { keyPathToName[\RecommendBookDependency.bookOrderFactory] = "bookOrderFactory-any BookOrderFactory" @@ -213,6 +297,16 @@ extension EventDetailComponent: Registration { keyPathToName[\EventDetailDependency.eventFactory] = "eventFactory-any EventFactory" } } +extension BookDetailComponent: Registration { + public func registerItems() { + keyPathToName[\BookDetailDependency.editBookFactory] = "editBookFactory-any EditBookFactory" + } +} +extension EditBookOrderComponent: Registration { + public func registerItems() { + + } +} extension AppComponent: Registration { public func registerItems() { @@ -239,6 +333,11 @@ extension AppComponent: Registration { localTable["bookOrderFactory-any BookOrderFactory"] = { [unowned self] in self.bookOrderFactory as Any } localTable["mindwayIntroduceFactory-any MindwayIntroduceFactory"] = { [unowned self] in self.mindwayIntroduceFactory as Any } localTable["eventDetailFactory-any EventDetailFactory"] = { [unowned self] in self.eventDetailFactory as Any } + localTable["editBookOrderFactory-any EditBookOrderFactory"] = { [unowned self] in self.editBookOrderFactory as Any } + localTable["goalReadingFactory-any GoalReadingFactory"] = { [unowned self] in self.goalReadingFactory as Any } + localTable["bookDetailFactory-any BookDetailFactory"] = { [unowned self] in self.bookDetailFactory as Any } + localTable["bookPostFactory-any BookPostFactory"] = { [unowned self] in self.bookPostFactory as Any } + localTable["editBookFactory-any EditBookFactory"] = { [unowned self] in self.editBookFactory as Any } localTable["remoteNoticeDataSource-any RemoteNoticeDataSource"] = { [unowned self] in self.remoteNoticeDataSource as Any } localTable["noticeRepository-any NoticeRepository"] = { [unowned self] in self.noticeRepository as Any } localTable["fetchNoticeUseCase-any FetchNoticeUseCase"] = { [unowned self] in self.fetchNoticeUseCase as Any } @@ -283,15 +382,20 @@ private func registerProviderFactory(_ componentPath: String, _ factory: @escapi @inline(never) private func register1() { registerProviderFactory("^->AppComponent->EventComponent", factory59c5e0d7ceb1b46b5a25f47b58f8f304c97af4d5) + registerProviderFactory("^->AppComponent->GoalReadingComponent", factory64ab00ae624edb5fc801f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->MyPageComponent", factory0f6f456ebf157d02dfb3f47b58f8f304c97af4d5) - registerProviderFactory("^->AppComponent->MainComponent", factoryc9274e46e78e70f29c54e3b0c44298fc1c149afb) + registerProviderFactory("^->AppComponent->BookPostComponent", factoryb66a93c7baaaea754546e3b0c44298fc1c149afb) + registerProviderFactory("^->AppComponent->MainComponent", factoryc9274e46e78e70f29c54f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->MindwayIntroduceComponent", factoryf6e8064cd5a3d7f6fe63f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->TabBarComponent", factory9dac845129838b40415cf47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->RootComponent", factory264bfc4d4cb6b0629b40f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->SigninComponent", factory2882a056d84a613debccf47b58f8f304c97af4d5) + registerProviderFactory("^->AppComponent->EditBookComponent", factory50d6bb212becd2bdda91e3b0c44298fc1c149afb) registerProviderFactory("^->AppComponent->RecommendBookComponent", factory2ba4c0e89046a26569d4f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->BookOrderComponent", factory42c646092382554dd34cf47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->EventDetailComponent", factory8610907cee92bde36225f47b58f8f304c97af4d5) + registerProviderFactory("^->AppComponent->BookDetailComponent", factory7813ba428cd9266b6527f47b58f8f304c97af4d5) + registerProviderFactory("^->AppComponent->EditBookOrderComponent", factory656219adf97836b74cc2e3b0c44298fc1c149afb) registerProviderFactory("^->AppComponent", factoryEmptyDependencyProvider) } #endif diff --git a/App/Sources/Feature/BookDetailFeature/Interface/BookDetailFactory.swift b/App/Sources/Feature/BookDetailFeature/Interface/BookDetailFactory.swift new file mode 100644 index 0000000..9830347 --- /dev/null +++ b/App/Sources/Feature/BookDetailFeature/Interface/BookDetailFactory.swift @@ -0,0 +1,6 @@ +import SwiftUI + +public protocol BookDetailFactory { + associatedtype SomeView: View + func makeView() -> SomeView +} diff --git a/App/Sources/Feature/BookDetailFeature/Sources/BookDetailComponent.swift b/App/Sources/Feature/BookDetailFeature/Sources/BookDetailComponent.swift new file mode 100644 index 0000000..85f160a --- /dev/null +++ b/App/Sources/Feature/BookDetailFeature/Sources/BookDetailComponent.swift @@ -0,0 +1,15 @@ +import NeedleFoundation +import Service +import SwiftUI + +public protocol BookDetailDependency: Dependency { + var editBookFactory: any EditBookFactory { get } +} + +public final class BookDetailComponent: Component, BookDetailFactory { + public func makeView() -> some View { + BookDetailView( + editBookFactory: dependency.editBookFactory + ) + } +} diff --git a/App/Sources/Feature/BookDetailFeature/BookDetailView.swift b/App/Sources/Feature/BookDetailFeature/Sources/BookDetailView.swift similarity index 91% rename from App/Sources/Feature/BookDetailFeature/BookDetailView.swift rename to App/Sources/Feature/BookDetailFeature/Sources/BookDetailView.swift index e321b17..e7ba863 100644 --- a/App/Sources/Feature/BookDetailFeature/BookDetailView.swift +++ b/App/Sources/Feature/BookDetailFeature/Sources/BookDetailView.swift @@ -1,9 +1,17 @@ import SwiftUI struct BookDetailView: View { - @StateObject var viewModel: BookDetailViewModel + @StateObject var viewModel = BookDetailViewModel() @Environment(\.dismiss) var dismiss + private let editBookFactory: any EditBookFactory + + init( + editBookFactory: any EditBookFactory + ) { + self.editBookFactory = editBookFactory + } + var body: some View { ZStack { NavigationView { @@ -76,13 +84,10 @@ struct BookDetailView: View { } .padding(.horizontal, 24) } - .fullScreenCover( - isPresented: Binding( - get: { viewModel.isNavigateBookEditPage }, - set: { _ in} - ) - ) { - EditBookView(viewModel: EditBookViewModel()) + .fullScreenCover(isPresented: $viewModel.isNavigateBookEditPage) { + editBookFactory + .makeView() + .eraseToAnyView() } } } diff --git a/App/Sources/Feature/BookDetailFeature/BookDetailViewModel.swift b/App/Sources/Feature/BookDetailFeature/Sources/BookDetailViewModel.swift similarity index 100% rename from App/Sources/Feature/BookDetailFeature/BookDetailViewModel.swift rename to App/Sources/Feature/BookDetailFeature/Sources/BookDetailViewModel.swift diff --git a/App/Sources/Feature/BookPostFeature/Interface/BookPostFactory.swift b/App/Sources/Feature/BookPostFeature/Interface/BookPostFactory.swift new file mode 100644 index 0000000..07e21ce --- /dev/null +++ b/App/Sources/Feature/BookPostFeature/Interface/BookPostFactory.swift @@ -0,0 +1,6 @@ +import SwiftUI + +public protocol BookPostFactory { + associatedtype SomeView: View + func makeView() -> SomeView +} diff --git a/App/Sources/Feature/BookPostFeature/Sources/BookPostComponent.swift b/App/Sources/Feature/BookPostFeature/Sources/BookPostComponent.swift new file mode 100644 index 0000000..e2c181f --- /dev/null +++ b/App/Sources/Feature/BookPostFeature/Sources/BookPostComponent.swift @@ -0,0 +1,11 @@ +import NeedleFoundation +import Service +import SwiftUI + +public protocol BookPostDependency: Dependency {} + +public final class BookPostComponent: Component, BookPostFactory { + public func makeView() -> some View { + BookPostView(viewModel: BookPostViewModel()) + } +} diff --git a/App/Sources/Feature/BookPostFeature/BookPostView.swift b/App/Sources/Feature/BookPostFeature/Sources/BookPostView.swift similarity index 100% rename from App/Sources/Feature/BookPostFeature/BookPostView.swift rename to App/Sources/Feature/BookPostFeature/Sources/BookPostView.swift diff --git a/App/Sources/Feature/BookPostFeature/BookPostViewModel.swift b/App/Sources/Feature/BookPostFeature/Sources/BookPostViewModel.swift similarity index 100% rename from App/Sources/Feature/BookPostFeature/BookPostViewModel.swift rename to App/Sources/Feature/BookPostFeature/Sources/BookPostViewModel.swift diff --git a/App/Sources/Feature/EditBookFeature/Interface/EditBookFactory.swift b/App/Sources/Feature/EditBookFeature/Interface/EditBookFactory.swift new file mode 100644 index 0000000..f67209c --- /dev/null +++ b/App/Sources/Feature/EditBookFeature/Interface/EditBookFactory.swift @@ -0,0 +1,6 @@ +import SwiftUI + +public protocol EditBookFactory { + associatedtype SomeView: View + func makeView() -> SomeView +} diff --git a/App/Sources/Feature/EditBookFeature/Sources/EditBookComponent.swift b/App/Sources/Feature/EditBookFeature/Sources/EditBookComponent.swift new file mode 100644 index 0000000..6df17c9 --- /dev/null +++ b/App/Sources/Feature/EditBookFeature/Sources/EditBookComponent.swift @@ -0,0 +1,12 @@ +import NeedleFoundation +import Service +import SwiftUI + +public protocol EditBookDependency: Dependency {} + +public final class EditBookComponent: Component, EditBookFactory { + public func makeView() -> some View { + EditBookView(viewModel: EditBookViewModel()) + } +} + diff --git a/App/Sources/Feature/EditBookFeature/EditBookView.swift b/App/Sources/Feature/EditBookFeature/Sources/EditBookView.swift similarity index 95% rename from App/Sources/Feature/EditBookFeature/EditBookView.swift rename to App/Sources/Feature/EditBookFeature/Sources/EditBookView.swift index 0bdcb55..f5d68c9 100644 --- a/App/Sources/Feature/EditBookFeature/EditBookView.swift +++ b/App/Sources/Feature/EditBookFeature/Sources/EditBookView.swift @@ -1,7 +1,7 @@ import SwiftUI struct EditBookView: View { - @StateObject var viewModel: EditBookViewModel + @StateObject var viewModel = EditBookViewModel() @Environment(\.dismiss) var dismiss var body: some View { diff --git a/App/Sources/Feature/EditBookFeature/EditBookViewModel.swift b/App/Sources/Feature/EditBookFeature/Sources/EditBookViewModel.swift similarity index 100% rename from App/Sources/Feature/EditBookFeature/EditBookViewModel.swift rename to App/Sources/Feature/EditBookFeature/Sources/EditBookViewModel.swift diff --git a/App/Sources/Feature/EditBookOrderFeature/Interface/EditBookOrderFactory.swift b/App/Sources/Feature/EditBookOrderFeature/Interface/EditBookOrderFactory.swift new file mode 100644 index 0000000..3bce567 --- /dev/null +++ b/App/Sources/Feature/EditBookOrderFeature/Interface/EditBookOrderFactory.swift @@ -0,0 +1,6 @@ +import SwiftUI + +public protocol EditBookOrderFactory { + associatedtype SomeView: View + func makeView() -> SomeView +} diff --git a/App/Sources/Feature/EditBookOrderFeature/Sources/EditBookOrderComponent.swift b/App/Sources/Feature/EditBookOrderFeature/Sources/EditBookOrderComponent.swift new file mode 100644 index 0000000..d8e135d --- /dev/null +++ b/App/Sources/Feature/EditBookOrderFeature/Sources/EditBookOrderComponent.swift @@ -0,0 +1,11 @@ +import NeedleFoundation +import Service +import SwiftUI + +public protocol EditBookOrderDependency: Dependency {} + +public final class EditBookOrderComponent: Component, EditBookOrderFactory { + public func makeView() -> some View { + EditBookOrderView(viewModel: EditBookOrderViewModel()) + } +} diff --git a/App/Sources/Feature/EditBookOrderView.swift b/App/Sources/Feature/EditBookOrderFeature/Sources/EditBookOrderView.swift similarity index 76% rename from App/Sources/Feature/EditBookOrderView.swift rename to App/Sources/Feature/EditBookOrderFeature/Sources/EditBookOrderView.swift index 92deb6d..855db25 100644 --- a/App/Sources/Feature/EditBookOrderView.swift +++ b/App/Sources/Feature/EditBookOrderFeature/Sources/EditBookOrderView.swift @@ -3,7 +3,7 @@ import SwiftUI struct EditBookOrderView: View { @StateObject var viewModel: EditBookOrderViewModel @Environment(\.dismiss) var dismiss - + var body: some View { ZStack { NavigationView { @@ -35,17 +35,20 @@ struct EditBookOrderView: View { MindWayButton( text: "수정하기", buttonStyle: .default - ) { } + ) { + dismiss() + #warning("수정 API 연결 시 서버로 보내는 기능 추가하기") + } .padding(.bottom, 20) } - .padding(.horizontal, 24) - } - .mindWayBackButton(dismiss: dismiss) - .toolbar { - ToolbarItem(placement: .principal) { - Text("도서 수정") - .mindWaySemiboldFont(.m2) + .mindWayBackButton(dismiss: dismiss) + .toolbar { + ToolbarItem(placement: .principal) { + Text("도서 수정") + .mindWaySemiboldFont(.m2) + } } + .padding(.horizontal, 24) } } } diff --git a/App/Sources/Feature/EditBookOrderViewModel.swift b/App/Sources/Feature/EditBookOrderFeature/Sources/EditBookOrderViewModel.swift similarity index 100% rename from App/Sources/Feature/EditBookOrderViewModel.swift rename to App/Sources/Feature/EditBookOrderFeature/Sources/EditBookOrderViewModel.swift diff --git a/App/Sources/Feature/GoalReadingFeature/Interface/GoalReadingFactory.swift b/App/Sources/Feature/GoalReadingFeature/Interface/GoalReadingFactory.swift new file mode 100644 index 0000000..f67c1fd --- /dev/null +++ b/App/Sources/Feature/GoalReadingFeature/Interface/GoalReadingFactory.swift @@ -0,0 +1,6 @@ +import SwiftUI + +public protocol GoalReadingFactory { + associatedtype SomeView: View + func makeView() -> SomeView +} diff --git a/App/Sources/Feature/GoalReadingFeature/Sources/GoalReadingComponent.swift b/App/Sources/Feature/GoalReadingFeature/Sources/GoalReadingComponent.swift new file mode 100644 index 0000000..2dac2c8 --- /dev/null +++ b/App/Sources/Feature/GoalReadingFeature/Sources/GoalReadingComponent.swift @@ -0,0 +1,17 @@ +import NeedleFoundation +import Service +import SwiftUI + +public protocol GoalReadingDependency: Dependency { + var bookDetailFactory: any BookDetailFactory { get } + var bookPostFactory: any BookPostFactory { get } +} + +public final class GoalReadingComponent: Component, GoalReadingFactory { + public func makeView() -> some View { + GoalReadingView( + bookDetailFactory: dependency.bookDetailFactory, + bookPostFactory: dependency.bookPostFactory + ) + } +} diff --git a/App/Sources/Feature/GoalReadingFeature/GoalReadingView.swift b/App/Sources/Feature/GoalReadingFeature/Sources/GoalReadingView.swift similarity index 80% rename from App/Sources/Feature/GoalReadingFeature/GoalReadingView.swift rename to App/Sources/Feature/GoalReadingFeature/Sources/GoalReadingView.swift index 93ef04a..7cb10b3 100644 --- a/App/Sources/Feature/GoalReadingFeature/GoalReadingView.swift +++ b/App/Sources/Feature/GoalReadingFeature/Sources/GoalReadingView.swift @@ -2,11 +2,22 @@ import SwiftUI struct GoalReadingView: View { @Environment(\.dismiss) var dismiss - @StateObject var viewModel: GoalReadingViewModel + @StateObject var viewModel = GoalReadingViewModel() var week: [String] = ["일", "월", "화", "수", "목", "금", "토"] var bookCount: [Int] = [0, 2, 2, 4, 1, 0, 0] + private let bookDetailFactory: any BookDetailFactory + private let bookPostFactory: any BookPostFactory + + init( + bookDetailFactory: any BookDetailFactory, + bookPostFactory: any BookPostFactory + ) { + self.bookDetailFactory = bookDetailFactory + self.bookPostFactory = bookPostFactory + } + var body: some View { NavigationView { ZStack { @@ -40,6 +51,9 @@ struct GoalReadingView: View { ForEach(0..<2, id: \.self) { _ in readingBookList() + .onTapGesture { + viewModel.isNavigateBookDetailPage = true + } } Spacer() @@ -65,13 +79,15 @@ struct GoalReadingView: View { .mindWayBottomSheet(isShowing: $viewModel.isShowingSettingPage) { SettingGoalReadingView(viewModel: GoalReadingViewModel()) } - .fullScreenCover( - isPresented: Binding( - get: { viewModel.isNavigateBookPostPage }, - set: { _ in } - ) - ) { - BookPostView(viewModel: BookPostViewModel()) + .fullScreenCover(isPresented: $viewModel.isNavigateBookPostPage) { + bookPostFactory + .makeView() + .eraseToAnyView() + } + .fullScreenCover(isPresented: $viewModel.isNavigateBookDetailPage) { + bookDetailFactory + .makeView() + .eraseToAnyView() } } diff --git a/App/Sources/Feature/GoalReadingFeature/VIewModel/GoalReadingViewModel.swift b/App/Sources/Feature/GoalReadingFeature/Sources/GoalReadingViewModel.swift similarity index 79% rename from App/Sources/Feature/GoalReadingFeature/VIewModel/GoalReadingViewModel.swift rename to App/Sources/Feature/GoalReadingFeature/Sources/GoalReadingViewModel.swift index b8e655f..9d96ef7 100644 --- a/App/Sources/Feature/GoalReadingFeature/VIewModel/GoalReadingViewModel.swift +++ b/App/Sources/Feature/GoalReadingFeature/Sources/GoalReadingViewModel.swift @@ -4,4 +4,5 @@ final class GoalReadingViewModel: ObservableObject { @Published var bookCount = "" @Published var isNavigateBookPostPage = false @Published var isShowingSettingPage = false + @Published var isNavigateBookDetailPage = false } diff --git a/App/Sources/Feature/MainFeature/Sources/MainComponent.swift b/App/Sources/Feature/MainFeature/Sources/MainComponent.swift index 226d9ba..2bc986e 100644 --- a/App/Sources/Feature/MainFeature/Sources/MainComponent.swift +++ b/App/Sources/Feature/MainFeature/Sources/MainComponent.swift @@ -2,10 +2,12 @@ import NeedleFoundation import Service import SwiftUI -public protocol MainDependency: Dependency {} +public protocol MainDependency: Dependency { + var goalReadingFactory: any GoalReadingFactory { get } +} public final class MainComponent: Component, MainFactory { public func makeView() -> some View { - MainView() + MainView(goalReadingFactory: dependency.goalReadingFactory) } } diff --git a/App/Sources/Feature/MainFeature/Sources/MainView.swift b/App/Sources/Feature/MainFeature/Sources/MainView.swift index c6f7ea0..b81c4cf 100644 --- a/App/Sources/Feature/MainFeature/Sources/MainView.swift +++ b/App/Sources/Feature/MainFeature/Sources/MainView.swift @@ -3,6 +3,15 @@ import SwiftUI struct MainView: View { var week: [String] = ["일", "월", "화", "수", "목", "금", "토"] var bookCount: [Int] = [0, 2, 2, 4, 1, 0, 0] + @State var isShowingGoalReading: Bool = false + + private let goalReadingFactory: any GoalReadingFactory + + init( + goalReadingFactory: any GoalReadingFactory + ) { + self.goalReadingFactory = goalReadingFactory + } var body: some View { VStack(spacing: 0) { @@ -31,8 +40,11 @@ struct MainView: View { Spacer() - Image(systemName: "chevron.right") - .foregroundColor(.mindway(.gray(.g4))) + MindWayAsset.Icons.chevronRightGray.swiftUIImage + .onTapGesture { + isShowingGoalReading = true + } + } .padding(.horizontal, 48) .padding(.top, 6) @@ -69,6 +81,11 @@ struct MainView: View { Spacer() } + .fullScreenCover(isPresented: $isShowingGoalReading) { + goalReadingFactory + .makeView() + .eraseToAnyView() + } } @ViewBuilder diff --git a/App/Sources/Feature/MindWayIntroduceFeature/Sources/MindWayIntroduceView.swift b/App/Sources/Feature/MindWayIntroduceFeature/Sources/MindWayIntroduceView.swift index 6700c44..ff01015 100644 --- a/App/Sources/Feature/MindWayIntroduceFeature/Sources/MindWayIntroduceView.swift +++ b/App/Sources/Feature/MindWayIntroduceFeature/Sources/MindWayIntroduceView.swift @@ -42,6 +42,5 @@ struct MindWayIntroduceView: View { } } } - } } diff --git a/App/Sources/Feature/MyPageFeature/Sources/MyPageComponent.swift b/App/Sources/Feature/MyPageFeature/Sources/MyPageComponent.swift index 61846df..f0890fa 100644 --- a/App/Sources/Feature/MyPageFeature/Sources/MyPageComponent.swift +++ b/App/Sources/Feature/MyPageFeature/Sources/MyPageComponent.swift @@ -4,10 +4,15 @@ import SwiftUI public protocol MyPageDependency: Dependency { var mindwayIntroduceFactory: any MindwayIntroduceFactory { get } + var editBookOrderFactory: any EditBookOrderFactory { get } } public final class MyPageComponent: Component, MyPageFactory { public func makeView() -> some View { - MyPageView(viewModel: MyPageViewModel(), mindwayIntroduceFactory: dependency.mindwayIntroduceFactory) + MyPageView( + viewModel: MyPageViewModel(), + mindwayIntroduceFactory: dependency.mindwayIntroduceFactory, + editBookOrderFactory: dependency.editBookOrderFactory + ) } } diff --git a/App/Sources/Feature/MyPageFeature/Sources/MyPageView.swift b/App/Sources/Feature/MyPageFeature/Sources/MyPageView.swift index 48a04f4..26d10f8 100644 --- a/App/Sources/Feature/MyPageFeature/Sources/MyPageView.swift +++ b/App/Sources/Feature/MyPageFeature/Sources/MyPageView.swift @@ -5,13 +5,16 @@ struct MyPageView: View { @StateObject var viewModel: MyPageViewModel private let mindwayIntroduceFactory: any MindwayIntroduceFactory + private let editBookOrderFactory: any EditBookOrderFactory init( viewModel: MyPageViewModel, - mindwayIntroduceFactory: any MindwayIntroduceFactory + mindwayIntroduceFactory: any MindwayIntroduceFactory, + editBookOrderFactory: any EditBookOrderFactory ) { _viewModel = StateObject(wrappedValue: viewModel) self.mindwayIntroduceFactory = mindwayIntroduceFactory + self.editBookOrderFactory = editBookOrderFactory } var body: some View { @@ -102,6 +105,11 @@ struct MyPageView: View { .makeView() .eraseToAnyView() } + .fullScreenCover(isPresented: $viewModel.isShowingUpdateBook) { + editBookOrderFactory + .makeView() + .eraseToAnyView() + } } @ViewBuilder @@ -120,6 +128,9 @@ struct MyPageView: View { Spacer() MindWayAsset.Icons.edit.swiftUIImage + .onTapGesture { + viewModel.isShowingUpdateBook = true + } MindWayAsset.Icons.trash.swiftUIImage .onTapGesture { diff --git a/App/Sources/Feature/MyPageFeature/Sources/MyPageViewModel.swift b/App/Sources/Feature/MyPageFeature/Sources/MyPageViewModel.swift index aa8ed9e..c439232 100644 --- a/App/Sources/Feature/MyPageFeature/Sources/MyPageViewModel.swift +++ b/App/Sources/Feature/MyPageFeature/Sources/MyPageViewModel.swift @@ -4,4 +4,5 @@ final class MyPageViewModel: ObservableObject { @Published var isShowingDeleteAlert = false @Published var isShowingBottomSheet = false @Published var isNavigateMindWayIntroducePage = false + @Published var isShowingUpdateBook = false }