diff --git a/JLPTVoca/JLPTVoca/ContentView.swift b/JLPTVoca/JLPTVoca/ContentView.swift index a8407d7..ad0899f 100644 --- a/JLPTVoca/JLPTVoca/ContentView.swift +++ b/JLPTVoca/JLPTVoca/ContentView.swift @@ -25,9 +25,9 @@ struct ContentView: View { Label("사전", systemImage: "book.fill") } - DictionaryView() + SettingView() .tabItem { - Label("전체 사전", systemImage: "book.fill") + Label("설정", systemImage: "gearshape.fill") } } .environment(wordManager) diff --git a/JLPTVoca/JLPTVoca/Managers/WordManager.swift b/JLPTVoca/JLPTVoca/Managers/WordManager.swift index 8589b7a..0d88e3e 100644 --- a/JLPTVoca/JLPTVoca/Managers/WordManager.swift +++ b/JLPTVoca/JLPTVoca/Managers/WordManager.swift @@ -39,7 +39,7 @@ final class WordManager { if direction == .left { swipedWord.maturityState += 1 } else { - swipedWord.maturityState = 1 + swipedWord.maturityState = 2 } wordDeck.removeAll { $0.id == id } diff --git a/JLPTVoca/JLPTVoca/Navigation/AppRoute.swift b/JLPTVoca/JLPTVoca/Navigation/AppRoute.swift new file mode 100644 index 0000000..97c03b0 --- /dev/null +++ b/JLPTVoca/JLPTVoca/Navigation/AppRoute.swift @@ -0,0 +1,19 @@ + +// +// AppRoute.swift +// JLPTVoca +// +// Created by Rama on 8/31/25. +// + +import Foundation + +enum HomeRoute: Hashable { + case wordStudy +} + +enum DictionaryRoute: Hashable { + case entireWords + case favoriteWords +} + diff --git a/JLPTVoca/JLPTVoca/Navigation/NavigationManager.swift b/JLPTVoca/JLPTVoca/Navigation/NavigationManager.swift new file mode 100644 index 0000000..0154d2b --- /dev/null +++ b/JLPTVoca/JLPTVoca/Navigation/NavigationManager.swift @@ -0,0 +1,25 @@ +// +// NavigationManager.swift +// JLPTVoca +// +// Created by Rama on 8/31/25. +// + +import SwiftUI + +@Observable +final class NavigationManager { + var path = NavigationPath() + + func navigate(_ route: Route) { + path.append(route) + } + + func pop() { + path.removeLast() + } + + func popToRoot() { + path.removeLast(path.count) + } +} diff --git a/JLPTVoca/JLPTVoca/Views/HomeView.swift b/JLPTVoca/JLPTVoca/Views/HomeView.swift index 7dbaeed..aa0e6f4 100644 --- a/JLPTVoca/JLPTVoca/Views/HomeView.swift +++ b/JLPTVoca/JLPTVoca/Views/HomeView.swift @@ -9,22 +9,14 @@ import SwiftUI struct HomeView: View { @Environment(WordManager.self) private var wordManager - - @State private var isStudyViewActive = false + @State private var router = NavigationManager() var body: some View { - NavigationStack { + NavigationStack(path: $router.path) { VStack(spacing: 20) { - NavigationLink( - destination: WordStudyView(), - isActive: $isStudyViewActive - ) { - EmptyView() - } - Button(action: { wordManager.prepareSession() - isStudyViewActive = true + router.navigate(.wordStudy) }) { Text("단어 학습 시작") .font(.title2) @@ -35,8 +27,15 @@ struct HomeView: View { .cornerRadius(10) } } - .navigationTitle("홈") + .navigationTitle("JLPT-VOCA") + .navigationDestination(for: HomeRoute.self) { route in + switch route { + case .wordStudy: + WordStudyView() + } + } } + .environment(router) } }