element-ios/RiotSwiftUI/Modules/Common/ActivityIndicator/ActivityIndicator.swift

35 lines
898 B
Swift

//
// Copyright 2021-2024 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only
// Please see LICENSE in the repository root for full details.
//
import SwiftUI
/// A visual cue to user that something is in progress.
struct ActivityIndicator: View {
private enum Constants {
static let backgroundColor = Color(UIColor(white: 0.8, alpha: 0.9))
}
var body: some View {
ProgressView()
.progressViewStyle(CircularProgressViewStyle(tint: Color.white))
.padding()
.background(Constants.backgroundColor)
.cornerRadius(5)
}
}
struct ActivityIndicator_Previews: PreviewProvider {
static var previews: some View {
Group {
Text("Hello World!")
.activityIndicator(show: true)
Text("Hello World!")
.activityIndicator(show: false)
}
}
}