Impressia/Vernissage/Widgets/LoadingIndicator.swift

30 lines
807 B
Swift
Raw Normal View History

2023-01-06 13:05:21 +01:00
//
// https://mczachurski.dev
// Copyright © 2023 Marcin Czachurski and the repository contributors.
2023-03-28 10:35:38 +02:00
// Licensed under the Apache License 2.0.
2023-01-06 13:05:21 +01:00
//
import SwiftUI
2023-01-15 13:03:54 +01:00
import ActivityIndicatorView
2023-01-06 13:05:21 +01:00
struct LoadingIndicator: View {
2023-01-20 13:47:38 +01:00
@EnvironmentObject var applicationState: ApplicationState
2023-01-15 13:03:54 +01:00
@Binding var isVisible: Bool
init(isVisible: Binding<Bool> = .constant(true)) {
self._isVisible = isVisible
}
2023-01-09 10:06:21 +01:00
2023-01-06 13:05:21 +01:00
var body: some View {
2023-01-15 13:03:54 +01:00
ActivityIndicatorView(isVisible: $isVisible, type: .equalizer(count: 5))
2023-01-18 18:41:42 +01:00
.frame(width: 24.0, height: 16.0)
2023-01-20 13:47:38 +01:00
.foregroundColor(applicationState.tintColor.color())
2023-01-06 13:05:21 +01:00
}
}
struct LoadingIndicator_Previews: PreviewProvider {
static var previews: some View {
2023-01-15 13:03:54 +01:00
LoadingIndicator(isVisible: .constant(true))
2023-01-06 13:05:21 +01:00
}
}