iPhone Duo (fase 1): navegación adaptativa por size class y layouts regular×regular
- ContentView: un único TabView (sidebarAdaptable en iOS 18+) para todas las size classes; desaparece el cambio de jerarquía iPhone/iPad, así abrir o cerrar el Duo conserva el estado de cada pestaña. @SceneStorage de la tab. - Fuentes y Diario: NavigationSplitView (lista + detalle a la vez en ancho regular, stack colapsable en compacto) con selección nativa de List. - Dashboard: Quick Update como .inspector (panel lateral junto a los gráficos en regular, sheet en compacto). - Gráficos: chartHeightScale (+35% de alto en regular) vía chartFrame(height:), sin ignoresSafeArea en contenido interactivo. - Liquid Glass (glassEffect) en las etiquetas flotantes del Diario en iOS 26+. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F1u4K16xy7eQVtgsYNZ9Vn
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import SwiftUI
|
||||
|
||||
// MARK: - Chart height scaling
|
||||
//
|
||||
// Charts declare a base height for compact width. Containers with a wider
|
||||
// canvas (regular width: iPad, iPhone Duo inner screen, Mac windows) raise the
|
||||
// scale so plots gain vertical room instead of just stretching horizontally.
|
||||
|
||||
extension EnvironmentValues {
|
||||
@Entry var chartHeightScale: CGFloat = 1
|
||||
}
|
||||
|
||||
private struct ChartFrameModifier: ViewModifier {
|
||||
@Environment(\.chartHeightScale) private var scale
|
||||
let base: CGFloat
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content.frame(height: base * scale)
|
||||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
/// Fixed chart height that follows `chartHeightScale` from the environment.
|
||||
func chartFrame(height: CGFloat) -> some View {
|
||||
modifier(ChartFrameModifier(base: height))
|
||||
}
|
||||
|
||||
/// Floating label background: Liquid Glass on iOS 26+, material fallback.
|
||||
@ViewBuilder
|
||||
func floatingPillBackground() -> some View {
|
||||
if #available(iOS 26.0, *) {
|
||||
self.glassEffect(.regular, in: .capsule)
|
||||
} else {
|
||||
self
|
||||
.background(.regularMaterial, in: Capsule())
|
||||
.shadow(color: .black.opacity(0.12), radius: 6, y: 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user