Caps-iOS/Caps/Camera/ErrorView.swift
2022-06-10 21:20:49 +02:00

28 lines
715 B
Swift

import SwiftUI
struct ErrorView: View {
var error: Error?
var body: some View {
VStack {
Text(error?.localizedDescription ?? "")
.bold()
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(8)
.foregroundColor(.white)
.background(Color.red.edgesIgnoringSafeArea(.top))
.opacity(error == nil ? 0.0 : 1.0)
.animation(.easeInOut, value: 0.25)
Spacer()
}
}
}
struct ErrorView_Previews: PreviewProvider {
static var previews: some View {
ErrorView(error: CameraError.cannotAddInput)
}
}