diff --git a/myApp/Haru_Danim/Haru_Danim.xcodeproj/project.xcworkspace/xcuserdata/ceuak.xcuserdatad/UserInterfaceState.xcuserstate b/myApp/Haru_Danim/Haru_Danim.xcodeproj/project.xcworkspace/xcuserdata/ceuak.xcuserdatad/UserInterfaceState.xcuserstate index 9af8754..00527a3 100644 Binary files a/myApp/Haru_Danim/Haru_Danim.xcodeproj/project.xcworkspace/xcuserdata/ceuak.xcuserdatad/UserInterfaceState.xcuserstate and b/myApp/Haru_Danim/Haru_Danim.xcodeproj/project.xcworkspace/xcuserdata/ceuak.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/myApp/Haru_Danim/IOS/ContentView.swift b/myApp/Haru_Danim/IOS/ContentView.swift index d2e0b19..e6df3ca 100644 --- a/myApp/Haru_Danim/IOS/ContentView.swift +++ b/myApp/Haru_Danim/IOS/ContentView.swift @@ -90,11 +90,19 @@ final class AppRouter { /// 기록 탭이 열릴 때 적용할 행동 필터 (기록 탭에서 소비 후 nil로 되돌림) var pendingHistoryActionID: PersistentIdentifier? - /// 기록 탭으로 이동하며 행동 필터를 예약. 기록 탭이 노출 탭에 없으면 더보기로 이동. + /// 더보기 탭 내부 내비게이션 경로. 더보기에 숨은 탭으로 바로 진입할 때 라우터가 채워 넣는다. + var morePath: [AppTab] = [] + + /// 기록 탭으로 이동하며 행동 필터를 예약. 기록 탭이 노출 탭에 없으면 더보기 안의 기록 화면까지 바로 진입. func openHistory(filtering actionID: PersistentIdentifier, visibleTabsRaw: String) { pendingHistoryActionID = actionID let visible = AppTab.visibleTabs(from: visibleTabsRaw) - tabSelection = visible.contains(.history) ? AppTab.history.rawValue : AppTab.moreTabValue + if visible.contains(.history) { + tabSelection = AppTab.history.rawValue + } else { + morePath = [.history] + tabSelection = AppTab.moreTabValue + } } } @@ -190,9 +198,12 @@ struct MainTabView: View { } .onAppear { #if DEBUG - // 검증용: -startTab이 노출 탭에 없으면 더보기 대신 그 탭 화면으로 안내되도록 보정 + // 검증용: -startTab이 노출 탭에 없으면 더보기 안의 그 화면까지 바로 진입 let valid = visibleTabs.map(\.rawValue) + [AppTab.moreTabValue] if !valid.contains(router.tabSelection) { + if let hidden = AppTab(rawValue: router.tabSelection) { + router.morePath = [hidden] + } router.tabSelection = AppTab.moreTabValue } #endif @@ -203,14 +214,14 @@ struct MainTabView: View { // MARK: - 더보기 탭 struct MoreTabView: View { + @Environment(AppRouter.self) private var router let tabs: [AppTab] var body: some View { - NavigationStack { + @Bindable var router = router + NavigationStack(path: $router.morePath) { List(tabs) { tab in - NavigationLink { - tab.rootView - } label: { + NavigationLink(value: tab) { Label { Text(tab.label) } icon: { @@ -222,6 +233,9 @@ struct MoreTabView: View { .scrollContentBackground(.hidden) .background(AppTheme.background) .navigationTitle("더보기") + .navigationDestination(for: AppTab.self) { tab in + tab.rootView + } } } }