- iOS 13.0+
ProgressHUD can only be used with the Swift Package Manager.
In Xcode, use the menu File > Swift Packages > Add Package Dependency
and enter the package URL https://github.com/ShogoTakeuchi/progress-hud.git.
- you can just simple use like this:
@State var hudVisible = true
@State var hudConfig = ProgressConfig(type: .loading)
var body: some View {
VStack(alignment: .leading) {
// more code
}
.overlay(ProgressHUD(isVisible: $viewModel.hudVisible, config: viewModel.hudConfig))
}
- if you want display fullscreen:
var body: some View {
Button(action: {
let config = ProgressConfig(type: .loading, shouldAutoHide: true)
ProgressWindow.shared.show(config: config)
}){
Text("Show HUD").font(.largeTitle)
}
}
see ProgressConfig
class for more information
MIT License.
© 2021, Shogo Takeuchi.