mycode/myApp/HaruDanim/IOS/Views/SidebarRootView.swift
songyc macbook 003859ee10 feat(mac): readability pass for Designed-for-iPad on Mac
- 실사용 보고: 맥에서 아이패드 앱 실행 시 버튼·정보가 전반적으로 매우 작게 보임
  (아이패드 포인트의 맥 축소 매핑 + 폭이 넓어져도 콘텐츠를 키우지 않는 레이아웃)
- DeviceLayout.isMac(isiOSAppOnMac) 신설, 맥에서만:
  ① 전역 dynamicTypeSize 최소 xLarge (사용자가 시스템에서 더 키우면 그 값 존중)
  ② 모음 탭 목표 카드 폭 430~640 / 행동 버튼 폭 200~280으로 상향
  ③ 사이드바에서 일기 탭 숨김 (AppTab.sidebarCases — 펜슬 필기 전제 기능이라
     맥에선 진입점 제거, 데이터는 보존되어 아이패드에서 계속 사용)
- 아이폰·아이패드 무영향 (isMac=false 경로 불변, 아이패드 심 회귀 스크린샷 확인)
- 검증: -forceMacLayout 인자 신설(아이패드 심에서 맥 분기 강제) — 일기 숨김·
  버튼 확대·글자 확대 확인. 맥(Designed for iPad) 대상 빌드 성공. 새 문자열 없음
- CLAUDE.md §6 맥 보정·§14 인자 기재. 맥 위젯·일기 마우스 입력은 출시 후 과제

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014CkLDi8Lr21vGqo4SjZaTp
2026-07-20 12:24:49 +09:00

90 lines
3.0 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
/// (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)
}