{"id":13778394,"url":"https://github.com/JonasGessner/JGProgressHUD-SwiftUI","last_synced_at":"2025-05-11T11:35:27.882Z","repository":{"id":45154187,"uuid":"304053674","full_name":"JonasGessner/JGProgressHUD-SwiftUI","owner":"JonasGessner","description":"Easily show HUDs with SwiftUI! Lightweight SwiftUI wrapper for JGProgressHUD for iOS, tvOS, Catalyst.","archived":false,"fork":false,"pushed_at":"2020-10-20T21:55:56.000Z","size":36,"stargazers_count":124,"open_issues_count":1,"forks_count":13,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-13T10:11:34.965Z","etag":null,"topics":["hud","ios","maccatalyst","progresshud","swift","swiftui","tvos"],"latest_commit_sha":null,"homepage":"https://jonasgessner.com","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JonasGessner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":["https://www.paypal.me/gessnerjonas","https://jonasgessner.com/crypto/BTC","https://jonasgessner.com/crypto/ETH"]}},"created_at":"2020-10-14T15:14:23.000Z","updated_at":"2025-03-11T09:58:35.000Z","dependencies_parsed_at":"2022-07-13T15:31:06.804Z","dependency_job_id":null,"html_url":"https://github.com/JonasGessner/JGProgressHUD-SwiftUI","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonasGessner%2FJGProgressHUD-SwiftUI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonasGessner%2FJGProgressHUD-SwiftUI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonasGessner%2FJGProgressHUD-SwiftUI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonasGessner%2FJGProgressHUD-SwiftUI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JonasGessner","download_url":"https://codeload.github.com/JonasGessner/JGProgressHUD-SwiftUI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253560193,"owners_count":21927745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hud","ios","maccatalyst","progresshud","swift","swiftui","tvos"],"created_at":"2024-08-03T18:00:53.516Z","updated_at":"2025-05-11T11:35:27.620Z","avatar_url":"https://github.com/JonasGessner.png","language":"Swift","funding_links":["https://www.paypal.me/gessnerjonas","https://jonasgessner.com/crypto/BTC","https://jonasgessner.com/crypto/ETH"],"categories":["Loading-Indicator"],"sub_categories":["Content"],"readme":"JGProgressHUD-SwiftUI\n---------------\n\nThis is a lightweight and easy-to-use SwiftUI wrapper for [JGProgressHUD](https://github.com/JonasGessner/JGProgressHUD), giving you access to the large and proven feature set of JGProgressHUD. Supports iOS, macCatalyst and tvOS 14.0+.\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/JonasGessner/JGProgressHUD/raw/master/Examples/Screenshots/Presentation.png\" style='height: 100%; width: 100%; object-fit: contain'/\u003e\n\u003c/p\u003e\n\n[![GitHub license](https://img.shields.io/github/license/JonasGessner/JGProgressHUD-SwiftUI.svg)](https://github.com/JonasGessner/JGProgressHUD-SwiftUI.svg/blob/master/LICENSE.txt)\n[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg)](https://swift.org/package-manager/)\n[![Mac Catalyst compatible](https://img.shields.io/badge/Catalyst-compatible-brightgreen.svg)](https://developer.apple.com/documentation/xcode/creating_a_mac_version_of_your_ipad_app/)\n\nInstallation\n--------------\n\nJGProgressHUD-SwiftUI can only be used with the Swift Package Manager.\n\nIn Xcode, use the menu File \u003e Swift Packages \u003e Add Package Dependency... and enter the package URL `https://github.com/JonasGessner/JGProgressHUD-SwiftUI.git`.\n\nUsage\n---------------\n\nThis package builds on top of the UIKit-based [JGProgressHUD](https://github.com/JonasGessner/JGProgressHUD) and provides a trivial way of showing HUDs in SwiftUI code.\n\nYou use the view `JGProgressHUDPresenter` as a canvas, which can display HUDs over its contents. Generally you want to use a single `JGProgressHUDPresenter` view as the root view of your application, such that full screen HUDs can be displayed.\n\nTo show a HUD from any contained view, define the environment object of type `JGProgressHUDCoordinator` in your view struct. This object is automatically available in the environment via `JGProgressHUDPresenter`. Call its `showHUD(constructor:handleExistingHUD:)` method, providing a `constructor` closure that returns the HUD to show. The returned HUD will be shown automatically, hence you do not need to call the `show()` method on the HUD. You may already schedule the HUD to disappear using the `dismiss(afterDelay:)` method.\n\nThe `handleExistingHUD` closure is only called in case a HUD is already presented. You can, for example, dismiss the current HUD and return `true` to continue showing the new HUD. By returning `false` (default), you prevent the new HUD from being shown.\n\nYou may furthermore access, modify or dismiss a HUD that is already presented by accessing the `presentedHUD` property of the `JGProgressHUDCoordinator` environment object. After a HUD dismisses, this property is automatically reset to `nil`.\n\nExample\n---------------\n\nAlso see the [Example Project](https://github.com/JonasGessner/JGProgressHUD-SwiftUI/tree/main/Example).\n\n ```swift\n import SwiftUI\n import JGProgressHUD_SwiftUI\n  \n struct NavigationBody: View {\n     // This environment object is automatically set by JGProgressHUDPresenter.\n     @EnvironmentObject var hudCoordinator: JGProgressHUDCoordinator\n \n     var body: some View {\n         Button(\"Press Me\") {\n             // Simply call showHUD and return your HUD!\n             hudCoordinator.showHUD {\n                 let hud = JGProgressHUD()\n                 hud.textLabel.text = \"Hello!\"\n                 hud.dismiss(afterDelay: 3)\n \n                 return hud\n             }\n         }\n     }\n }\n \n struct ContentView: View {\n     var body: some View {\n         // This presenter can present a fullscreen HUD.\n         JGProgressHUDPresenter {\n             NavigationView {\n                 NavigationBody()\n             }\n         }\n     }\n }\n ```\n\n\nRequirements\n------------\n\n- Deployment target of iOS/tvOS/macCatalyst 14.0 or higher.\n\n\nDetailed Documentation\n----------------\nPlease see the [JGProgressHUD project](https://github.com/JonasGessner/JGProgressHUD) for documentation on JGProgressHUD itself. \n\nSee the doc strings in [JGProgressHUD_SwiftUI.swift](https://github.com/JonasGessner/JGProgressHUD-SwiftUI/blob/main/Sources/JGProgressHUD-SwiftUI/JGProgressHUD_SwiftUI.swift) for more info.\n\nLicense\n---------\nMIT License.\u003cbr/\u003e\n© 2020, Jonas Gessner.\n\nCredits\n----------\nCreated and maintained by Jonas Gessner, © 2020.\u003cbr/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJonasGessner%2FJGProgressHUD-SwiftUI","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJonasGessner%2FJGProgressHUD-SwiftUI","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJonasGessner%2FJGProgressHUD-SwiftUI/lists"}