mycode/myApp/HaruDanim/IOS/Views/SidebarRootView.swift
songyc macbook 0a55b45515 feat(1.5-p6): 소킹 중 추가 5건 — 아이폰 일기 탭·일기 건강 카드·타임테이블 수면/운동 실구간·수면 표시 구간(요일별)·맥 필터 안내, 빌드 4
- 아이폰 일기 개방: AppTab.phoneCases·radialOrder, '그리기' 토글(손가락)·가로 도구줄, 일기 잠금 설정 전 기기
- 건강 카드: DiarySection.health(목록 끝), DiaryHealthCard(지표 선택 공용화·타일 상속·맥 숨김), 인쇄 요약 동승
- 타임테이블 실구간: HealthIntervals 캐시(App Group 400일, CloudKit 금지), injectingHealthBlocks(수면 인디고·운동 주황), 필터 '건강 데이터' 토글+맥 안내
- 수면 표시 구간: SleepWindowPrefs(전체+요일별), 평문 sleep 키=유효 구간 값, 백필 서명 매핑 포함, 새 수면 다짐 기본값 시드
- 실측 수정: 일기 목표 카드 건강 다짐 값 단위, ja 건강 칩 말줄임
- 검증 61/20/27/10 ALL PASS·3종 빌드·카탈로그 0/0·시각 QA 10여 장(26.5/18.5/맥 분기)
- 마케팅: 06-bubble 재촬영, 10-week→10-diary 교체, 아이패드 03 재촬영(3언어), whats-new/설명 갱신

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WtZwRRjbtM9pZJDM4FkTq6
2026-08-22 21:56:57 +09:00

92 lines
3.2 KiB
Swift

//
// SidebarRootView.swift
// Haru_Danim
//
// iPad · Mac(Designed for iPad) .
// iPhone MainTabView (rootView) NavigationSplitView .
// iPhone UI/ .
//
import SwiftUI
import SwiftData
import UIKit
/// (iPad, Mac Designed for iPad) .
/// iPhone( ) UI .
enum DeviceLayout {
static let isPad = UIDevice.current.userInterfaceIdiom == .pad
/// (1.5 '' · )
static let isPhone = UIDevice.current.userInterfaceIdiom == .phone
/// (Designed for iPad) .
/// ,
/// · / (· )
static let isMac: Bool = {
#if DEBUG
// : -forceMacLayout YES (§14)
if UserDefaults.standard.bool(forKey: "forceMacLayout") { return true }
#endif
return ProcessInfo.processInfo.isiOSAppOnMac
}()
}
struct SidebarRootView: View {
@State private var router: AppRouter
init() {
let router = AppRouter()
router.usesSidebar = true
_router = State(initialValue: router)
}
private var selectedTab: AppTab {
AppTab(rawValue: router.tabSelection) ?? .main
}
/// (String)
private var sidebarSelection: Binding<AppTab?> {
Binding {
AppTab(rawValue: router.tabSelection) ?? .main
} set: { newValue in
if let newValue {
router.tabSelection = newValue.rawValue
}
}
}
var body: some View {
NavigationSplitView {
List(selection: sidebarSelection) {
Section {
ForEach(AppTab.sidebarCases) { tab in
Label {
Text(tab.label)
} icon: {
Image(systemName: tab.symbol)
.foregroundStyle(AppTheme.green)
}
.tag(tab)
}
}
}
.listStyle(.sidebar)
.navigationTitle("하루 다님")
.navigationSplitViewColumnWidth(min: 190, ideal: 230, max: 300)
} detail: {
NavigationStack {
selectedTab.rootView
}
//
.id(selectedTab)
}
.environment(router)
}
}
#Preview {
SidebarRootView()
.modelContainer(for: [
Tag.self, Action.self, TimeSession.self,
CountEntry.self, Goal.self, Quest.self,
], inMemory: true)
}