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]>
50 lines
1.3 KiB
Swift
50 lines
1.3 KiB
Swift
// Copyright © 2025 Zama. All rights reserved.
|
|
// Copyright © 2025 Lux Industries Inc.
|
|
|
|
import SwiftUI
|
|
|
|
#Preview {
|
|
@Previewable @State var native = false
|
|
NavigationStack {
|
|
if native {
|
|
Color.yellow.overlay {
|
|
Toggle("Native", isOn: $native)
|
|
.padding()
|
|
}
|
|
.navigationTitle("Main Title")
|
|
} else {
|
|
Color.yellow.overlay {
|
|
Toggle("Native", isOn: $native)
|
|
.padding()
|
|
}
|
|
.navigationTitleView("Main Title", icon: "cloud.fill")
|
|
}
|
|
}
|
|
}
|
|
|
|
struct NavigationTitleViewModifier: ViewModifier {
|
|
let title: String
|
|
let icon: String
|
|
|
|
func body(content: Content) -> some View {
|
|
content
|
|
.padding(.top, 52)
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
.toolbar {
|
|
ToolbarItem(placement: .topBarLeading) {
|
|
Text("\(Image(systemName: icon)) \(title)")
|
|
.font(.largeTitle)
|
|
.imageScale(.small)
|
|
.bold()
|
|
.padding(.top, 92)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
extension View {
|
|
func navigationTitleView(_ title: String, icon: String) -> some View {
|
|
self.modifier(NavigationTitleViewModifier(title: title, icon: icon))
|
|
}
|
|
}
|