diff --git a/HappyAnding/HappyAnding/Extensions/View/View+Navigation.swift b/HappyAnding/HappyAnding/Extensions/View/View+Navigation.swift index 7657eb24..92c0798d 100644 --- a/HappyAnding/HappyAnding/Extensions/View/View+Navigation.swift +++ b/HappyAnding/HappyAnding/Extensions/View/View+Navigation.swift @@ -77,8 +77,8 @@ extension View { @ViewBuilder func getDestination(data: T) -> some View { switch data { - case is NavigationListShortcutType: - ListShortcutView(viewModel: ListShortcutViewModel(data: data as! NavigationListShortcutType)) + case is SectionType: + ListShortcutView(viewModel: ListShortcutViewModel(data: data as! SectionType)) case is NavigationReadShortcutType: ReadShortcutView(data: data as! NavigationReadShortcutType) case is Curation: @@ -127,7 +127,7 @@ struct NavigationViewModifier: ViewModifier { .navigationDestination(for: NavigationReadShortcutType.self) { data in ReadShortcutView(data: data) } - .navigationDestination(for: NavigationListShortcutType.self) { data in + .navigationDestination(for: SectionType.self) { data in ListShortcutView(viewModel: ListShortcutViewModel(data: data)) } .navigationDestination(for: NavigationListCategoryShortcutType.self) { data in diff --git a/HappyAnding/HappyAnding/Model/NavigationStackModel.swift b/HappyAnding/HappyAnding/Model/NavigationStackModel.swift index 5760ec24..dc562151 100644 --- a/HappyAnding/HappyAnding/Model/NavigationStackModel.swift +++ b/HappyAnding/HappyAnding/Model/NavigationStackModel.swift @@ -7,14 +7,6 @@ import SwiftUI -struct NavigationListShortcutType: Identifiable, Hashable { - var id = UUID().uuidString - - var sectionType: SectionType - var shortcuts: [Shortcuts]? - let navigationParentView: NavigationParentView -} - struct NavigationReadShortcutType: Identifiable, Hashable { var id = UUID().uuidString diff --git a/HappyAnding/HappyAnding/ViewModel/ListShortcutViewModel.swift b/HappyAnding/HappyAnding/ViewModel/ListShortcutViewModel.swift index b02c3216..77fcf0c3 100644 --- a/HappyAnding/HappyAnding/ViewModel/ListShortcutViewModel.swift +++ b/HappyAnding/HappyAnding/ViewModel/ListShortcutViewModel.swift @@ -15,9 +15,9 @@ final class ListShortcutViewModel: ObservableObject { @Published private(set) var sectionType: SectionType = .download - init(data: NavigationListShortcutType) { - shortcuts = data.shortcuts ?? [] - sectionType = data.sectionType + init(data: SectionType) { + sectionType = data + shortcuts = fetchShortcutsBySectionType() } func fetchShortcutsBySectionType() -> [Shortcuts] { diff --git a/HappyAnding/HappyAnding/Views/Components/MyShortcutCardListView.swift b/HappyAnding/HappyAnding/Views/Components/MyShortcutCardListView.swift index 70d5634b..f480d218 100644 --- a/HappyAnding/HappyAnding/Views/Components/MyShortcutCardListView.swift +++ b/HappyAnding/HappyAnding/Views/Components/MyShortcutCardListView.swift @@ -21,11 +21,6 @@ struct MyShortcutCardListView: View { @State var isGradeAlertPresented = false var shortcuts: [Shortcuts]? - var data: NavigationListShortcutType { - NavigationListShortcutType(sectionType: .myShortcut, - shortcuts: self.shortcuts, - navigationParentView: self.navigationParentView) - } let navigationParentView: NavigationParentView @@ -37,7 +32,7 @@ struct MyShortcutCardListView: View { Spacer() MoreCaptionTextView(text: TextLiteral.more) - .navigationLinkRouter(data: data) + .navigationLinkRouter(data: SectionType.myShortcut) } .padding(.horizontal, 16) diff --git a/HappyAnding/HappyAnding/Views/ExploreShortcutViews/ExploreShortcutView.swift b/HappyAnding/HappyAnding/Views/ExploreShortcutViews/ExploreShortcutView.swift index fa2d353b..8c9a66d0 100644 --- a/HappyAnding/HappyAnding/Views/ExploreShortcutViews/ExploreShortcutView.swift +++ b/HappyAnding/HappyAnding/Views/ExploreShortcutViews/ExploreShortcutView.swift @@ -121,9 +121,7 @@ extension ExploreShortcutView { Spacer() MoreCaptionTextView(text: TextLiteral.more) - .navigationLinkRouter(data: NavigationListShortcutType(sectionType: sectionType, - shortcuts: shortcuts, - navigationParentView: .shortcuts)) + .navigationLinkRouter(data: sectionType) } .padding(.horizontal, 16) .padding(.bottom, 12) diff --git a/HappyAnding/HappyAnding/Views/ExploreShortcutViews/ListShortcutView.swift b/HappyAnding/HappyAnding/Views/ExploreShortcutViews/ListShortcutView.swift index f3c6bc8d..25e3d711 100644 --- a/HappyAnding/HappyAnding/Views/ExploreShortcutViews/ListShortcutView.swift +++ b/HappyAnding/HappyAnding/Views/ExploreShortcutViews/ListShortcutView.swift @@ -28,7 +28,7 @@ struct ListShortcutView: View { LazyVStack(spacing: 0) { //TODO: 무한 스크롤을 위한 업데이트 함수 필요 - makeShortcutCellList(viewModel.fetchShortcutsBySectionType()) + makeShortcutCellList(viewModel.shortcuts) Rectangle() .fill(Color.shortcutsZipBackground) diff --git a/HappyAnding/HappyAnding/Views/MyPageViews/MyPageView.swift b/HappyAnding/HappyAnding/Views/MyPageViews/MyPageView.swift index 24d32177..8189d867 100644 --- a/HappyAnding/HappyAnding/Views/MyPageViews/MyPageView.swift +++ b/HappyAnding/HappyAnding/Views/MyPageViews/MyPageView.swift @@ -88,11 +88,6 @@ struct MyPageShortcutListCell: View { var type: SectionType let shortcuts: [Shortcuts] - var data: NavigationListShortcutType { - NavigationListShortcutType(sectionType: self.type, - shortcuts: self.shortcuts, - navigationParentView: .myPage) - } var body: some View { HStack() { Text(type == .myLovingShortcut ? TextLiteral.myPageViewLikedShortcuts : TextLiteral.myPageViewDownloadedShortcuts) @@ -119,6 +114,6 @@ struct MyPageShortcutListCell: View { } .frame(maxWidth: .infinity, alignment: .leading) .padding(.horizontal, 16) - .navigationLinkRouter(data: data) + .navigationLinkRouter(data: self.type) } }