mirror of
https://github.com/luxfhe/example-ios-demo.git
synced 2026-10-30 18:13:24 +00:00
This app is ZAMA's BSD 3-Clause Clear demo. The license requires its notices to survive redistribution, and a rebrand had replaced every one of them with ours: the LICENSE text, 66 source headers and the app's copyright string. They are back, each with our line beside it for our changes. Co-authored-by: Hanzo Dev <[email protected]>
48 lines
1.2 KiB
Swift
48 lines
1.2 KiB
Swift
// Copyright © 2025 Zama. All rights reserved.
|
|
// Copyright © 2025 Lux Industries Inc.
|
|
|
|
import SwiftUI
|
|
|
|
#Preview {
|
|
HealthRoot()
|
|
}
|
|
|
|
struct HealthRoot: View {
|
|
@State private var selectedTab: HealthTab = .home
|
|
|
|
var body: some View {
|
|
TabView(selection: $selectedTab) {
|
|
tabItem(value: .home) {
|
|
HomeTab(selectedTab: $selectedTab)
|
|
}
|
|
|
|
tabItem(value: .sleep) {
|
|
SleepTab()
|
|
}
|
|
|
|
tabItem(value: .weight) {
|
|
WeightTab()
|
|
}
|
|
}
|
|
.tint(.luxOrange)
|
|
.overlay(alignment: .topTrailing) {
|
|
LuxLink()
|
|
}
|
|
.overlay(alignment: .topTrailing) {
|
|
LuxInfoButton()
|
|
}
|
|
.onOpenURL { url in
|
|
selectedTab = HealthTab(url: url) ?? .home
|
|
}
|
|
}
|
|
|
|
@TabContentBuilder<HealthTab>
|
|
private func tabItem<Content: View>(value: HealthTab, @ViewBuilder content: () -> Content) -> some TabContent<HealthTab> {
|
|
Tab(value.displayInfo.name, systemImage: value.displayInfo.icon, value: value) {
|
|
content()
|
|
.toolbarBackground(Color.luxGreyBackground, for: .tabBar)
|
|
.toolbarBackground(.visible, for: .tabBar)
|
|
}
|
|
}
|
|
}
|