| 1 |
// |
|
| 2 |
// AdaptiveTabBarPresentation.swift |
|
| 3 |
// USB Meter |
|
| 4 |
// |
|
| 5 |
// Created by Codex on 22/04/2026. |
|
| 6 |
// |
|
| 7 | ||
| 8 |
import SwiftUI |
|
| 9 | ||
| 10 |
struct AdaptiveTabBarPresentation: Equatable {
|
|
| 11 |
let showsTitles: Bool |
|
| 12 |
let maxWidth: CGFloat |
|
| 13 | ||
| 14 |
static func standard(for size: CGSize) -> AdaptiveTabBarPresentation {
|
|
| 15 |
let compact = min(size.width, size.height) |
|
| 16 | ||
| 17 |
if compact < 700 {
|
|
| 18 |
return AdaptiveTabBarPresentation( |
|
| 19 |
showsTitles: false, |
|
| 20 |
maxWidth: 340 |
|
| 21 |
) |
|
| 22 |
} |
|
| 23 | ||
| 24 |
return AdaptiveTabBarPresentation( |
|
| 25 |
showsTitles: true, |
|
| 26 |
maxWidth: min(size.width - 32, 680) |
|
| 27 |
) |
|
| 28 |
} |
|
| 29 |
} |