diff --git a/HappyAnding/HappyAnding/ViewModel/ExploreShortcutViewModel.swift b/HappyAnding/HappyAnding/ViewModel/ExploreShortcutViewModel.swift index 8ae69669..9e0b5fc3 100644 --- a/HappyAnding/HappyAnding/ViewModel/ExploreShortcutViewModel.swift +++ b/HappyAnding/HappyAnding/ViewModel/ExploreShortcutViewModel.swift @@ -14,7 +14,6 @@ final class ExploreShortcutViewModel: ObservableObject { @Published private(set) var isCategoryCellViewFolded = true @Published var isTappedAnnouncementCell = false @Published private(set) var numberOfDisplayedCategories = 6 - @Published private(set) var randomCategories = Category.allCases.shuffled().prefix(2) func changeNumberOfCategories() { isCategoryCellViewFolded.toggle() diff --git a/HappyAnding/HappyAnding/Views/ExploreShortcutViews/ExploreShortcutView.swift b/HappyAnding/HappyAnding/Views/ExploreShortcutViews/ExploreShortcutView.swift index c633d7cb..7692a3b3 100644 --- a/HappyAnding/HappyAnding/Views/ExploreShortcutViews/ExploreShortcutView.swift +++ b/HappyAnding/HappyAnding/Views/ExploreShortcutViews/ExploreShortcutView.swift @@ -14,6 +14,8 @@ struct ExploreShortcutView: View { // TODO: 추후 UpdateInfoView 제작 시 true로 변경해서 cell 보이게 하기 @AppStorage("isUpdateAnnnouncementShow") var isUpdateAnnnouncementShow: Bool = false + let randomCategories: [Category] + var body: some View { ScrollViewReader { proxy in ScrollView { @@ -33,11 +35,11 @@ struct ExploreShortcutView: View { sectionView(with: .recent) .id(111) - categoryCardView(with: viewModel.randomCategories[0]) + categoryCardView(with: randomCategories[0]) sectionView(with: .download) - categoryCardView(with: viewModel.randomCategories[1]) + categoryCardView(with: randomCategories[1]) sectionView(with: .popular) diff --git a/HappyAnding/HappyAnding/Views/TabView/ShortcutTabView.swift b/HappyAnding/HappyAnding/Views/TabView/ShortcutTabView.swift index 4b17c112..cfadb0a0 100644 --- a/HappyAnding/HappyAnding/Views/TabView/ShortcutTabView.swift +++ b/HappyAnding/HappyAnding/Views/TabView/ShortcutTabView.swift @@ -27,6 +27,7 @@ struct ShortcutTabView: View { @State private var tempShortcutId = "" @State private var tempCurationId = "" + @State private var randomCategories = Category.allCases.shuffled().prefix(2) @State private var twiceTappedTab = 0 @State private var firstTabID = UUID() @@ -106,7 +107,7 @@ struct ShortcutTabView: View { @ViewBuilder private func firstTab() -> some View { - ExploreShortcutView(viewModel: ExploreShortcutViewModel()) + ExploreShortcutView(viewModel: ExploreShortcutViewModel(), randomCategories: Array(randomCategories)) .modifierNavigation() .navigationBarBackground ({ Color.shortcutsZipBackground }) .id(firstTabID)