I have a bug where the Tap Bar at the bottom is not properly shown in the camera view.
the home view
var body: some View {
TabView {
VStack {
ScrollView {
StatisticView()
HistoryView()
}
}
.tabItem {
Label("Home", systemImage: "house")
}
ManualItemAddView()
.tabItem {
Label("Food" , systemImage: "carrot.fill")
}
CameraView()
.tabItem {
Label("Scan", systemImage: "camera")
}
AddWaterView(waterAmount: $waterAmount)
.tabItem {
Label("Water", systemImage: "drop.fill")
}
InformationView()
.tabItem {
Label("Information", systemImage: "person")
}
DeveloperView()
.tabItem {
Label("Developer", systemImage: "hammer")
}
}
}
the camera view
var body: some View {
ZStack {
CameraPreview(session: controller.session)
.onAppear(perform: {
controller.startSession()
})
.onDisappear(perform: {
controller.session.stopRunning()
})
.edgesIgnoringSafeArea(.all) // Make CameraPreview take up the whole screen
VStack {
Spacer()
HStack {
Button(action: {
controller.processLastFrame()
}) {
Text("Snap")
.font(.system(size: 20, weight: .regular, design: .default))
.foregroundColor(.white)
.fontWeight(.regular)
.padding(.vertical, 15.0)
.padding(.horizontal, 20.0)
.frame(maxWidth: .infinity)
.background(Color.blue)
.accentColor(.white)
.cornerRadius(17.0)
}
}
.padding()
}
.alert(isPresented: $controller.showAlert) {
Alert(title: Text("Warning"),
message: Text("Nothing detected with sufficient confidence."),
dismissButton: .default(Text("OK")))
}
.sheet(isPresented: $controller.shouldShowDetectedItemSheet) {
if let detectedItem = controller.detectedItem {
let itemImage = controller.lastFrame
let itemCategory = controller.itemCategory
let itemCalories = controller.itemCalories
let itemSugar = controller.itemSugar
let itemDescription = controller.itemDescription
HistoryItemView(detectedItemName: detectedItem, date: Date(), shouldShowDetectedItemSheet: $controller.shouldShowDetectedItemSheet, isNewDetection: .constant(true))
}
}
}
.onReceive(controller.$shouldDismiss, perform: { shouldDismiss in
if shouldDismiss {
controller.shouldDismiss = false
controller.shouldNavigate = false // Reset the navigation flag
}
})
}
how its supposed to look
what it actually looks like in the camera view