Skip to content

SwiftUI progress view component

License

Notifications You must be signed in to change notification settings

ShogoTakeuchi/progress-hud

Repository files navigation

ProgressHUD

GitHub license SwiftPM compatible Mac Catalyst compatible

Requirements

  • iOS 13.0+

Installation

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.

Usage

  1. 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))
}
  1. 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

License

MIT License.
© 2021, Shogo Takeuchi.