Files
mowesta/ios-app/app/View/Custom/Loading.swift
T
pobel e5e341ab67
LocationBasedServices/mowesta/feature%2Fios%2Fdevices This commit looks good
adding localization for measurement and devices
2020-01-29 18:38:02 +01:00

47 lines
1.2 KiB
Swift

//
// LoadingView.swift
// app
//
// Created by Sebastian Pobel on 20.12.19.
// Copyright © 2019 Marcus Handte. All rights reserved.
//
import SwiftUI
struct Loading<Content>: View where Content: View {
@Binding var isShowing: Bool
var infoText: LocalizedStringKey
var content: () -> Content
var body: some View {
ZStack(alignment: .center) {
self.content()
.disabled(self.isShowing)
.blur(radius: self.isShowing ? 3 : 0)
VStack {
Text(self.infoText)
ActivityIndicator(style: .large)
}
.frame(minWidth: 200, minHeight: 100, alignment: .center)
.background(Color.secondary.colorInvert())
.foregroundColor(Color.primary)
.cornerRadius(20)
.opacity(self.isShowing ? 1 : 0)
}
}
}
struct Loading_Previews: PreviewProvider {
static var previews: some View {
Loading(isShowing: .constant(true), infoText: "Loading...") {
VStack{
Text("Content")
.font(.title)
Spacer()
}
}
}
}