GithubHelp home page GithubHelp logo

relatedcode / progresshud Goto Github PK

View Code? Open in Web Editor NEW
2.7K 55.0 443.0 4.83 MB

ProgressHUD is a lightweight and easy-to-use HUD for iOS. Over 5000+ animations. ‼️

Home Page: https://relatedcode.com

License: MIT License

Ruby 0.56% Swift 99.44%
progresshud progressbar progress-bar hud swift5 ios-swift progress-hud progress progress-circle apple

progresshud's Introduction

WHAT'S NEW

For detailed changes, please refer to the Change log.

OVERVIEW

ProgressHUD is a convenient and intuitive HUD tool designed specifically for iOS. It enables seamless presentation of concise alerts or notifications to users of your app in a simple and non-disruptive way.

INSTALLATION

‼️ In case you're using Xcode 14.3.1 or an earlier version, stick with 13.8.6 ‼️

CocoaPods

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects.

To incorporate the ProgressHUD library into your Xcode project utilizing CocoaPods, please reference it within your Podfile as shown below:

pod 'ProgressHUD'

Swift Package Manager

Swift Package Manager is a tool for managing the distribution of Swift code.

To add ProgressHUD as a dependency to your project, follow these steps:

  1. Open your Swift project in Xcode.
  2. Navigate to File -> Add Package Dependencies....
  3. Paste https://github.com/relatedcode/ProgressHUD.git into the search bar.
  4. Choose the version you want to use and click Add Package.

Manually

If you prefer not to use any of the dependency managers above, you can integrate ProgressHUD into your project manually. Just copy all the *.swift files from the ProgressHUD/Sources folder into your Xcode project.

QUICK START

ProgressHUD.banner("Banner title", "Banner message to display.")
ProgressHUD.banner("Banner title", "Message to display.", delay: 2.0)
ProgressHUD.bannerHide()
ProgressHUD.animate("Some text...")
ProgressHUD.animate("Some text...", interaction: false)
ProgressHUD.animate("Please wait...", .ballVerticalBounce)
ProgressHUD.succeed()
ProgressHUD.succeed("Some text...", delay: 1.5)
ProgressHUD.failed()
ProgressHUD.failed("Some text...")
ProgressHUD.progress(0.15)
ProgressHUD.progress("Loading...", 0.42)
ProgressHUD.symbol(name: "box.truck")
ProgressHUD.symbol("Some text...", name: "sun.max")
ProgressHUD.dismiss()
ProgressHUD.remove()

REQUIREMENTS

  • iOS 13.0+
  • Xcode 15.0+

CUSTOMIZATION

You can customize attributes like color, font, image, animation type, size, and more by using these methods:

ProgressHUD.animationType = .circleStrokeSpin
ProgressHUD.colorHUD = .systemGray
ProgressHUD.colorBackground = .lightGray
ProgressHUD.colorAnimation = .systemBlue
ProgressHUD.colorProgress = .systemBlue
ProgressHUD.colorStatus = .label
ProgressHUD.mediaSize = 100
ProgressHUD.marginSize = 50
ProgressHUD.fontStatus = .boldSystemFont(ofSize: 24)
ProgressHUD.imageSuccess = UIImage(named: "success.png")
ProgressHUD.imageError = UIImage(named: "error.png")

A comprehensive list of the predefined enums:

public enum AnimationType: CaseIterable {
	case none
	case activityIndicator
	case ballVerticalBounce
	case barSweepToggle
	case circleArcDotSpin
	case circleBarSpinFade
	case circleDotSpinFade
	case circlePulseMultiple
	case circlePulseSingle
	case circleRippleMultiple
	case circleRippleSingle
	case circleRotateChase
	case circleStrokeSpin
	case dualDotSidestep
	case horizontalBarScaling
	case horizontalDotScaling
	case pacmanProgress
	case quintupleDotDance
	case semiRingRotation
	case sfSymbolBounce
	case squareCircuitSnake
	case triangleDotShift
}
public enum LiveIcon {
	case succeed
	case failed
	case added
}

LICENSE

MIT License

Copyright (c) 2024 Related Code

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

progresshud's People

Contributors

abhi99555 avatar garethng avatar massimobio avatar moriturus avatar relatedcode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

progresshud's Issues

Hide and Show progress bar inside TableViewCells

I have TableView cells with custom views. I need to call multiple api calls at a time and i need to show progress bar in every view inside cell. Once i get data from api, need to hide progress bar.
Until the api is getting called need to show multiple progress bars inside each tableview cells.
Tableview

`Unexpectedly found nil` when showing banner

ProgressHUD/ProgressHUD+Banner.swift:117: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value

I am getting above crash when trying to show a banner with below code:

ProgressHUD.showBanner("Ghosting On", "Last image will now show to position your next shot", delay: 8.0)

Error leads to the following line in ProgressHUD+Banner.swift file

extension ProgressHUD {
	private func resizeBanner() {
		**let widthBanner = main.frame.width - 32**

xcode 14.3.1 error

I use xcode 14.3.1,HUD version is 14.1.0, this code build error, I do not hava ios17

		if #available(iOS 17.0, *) {
			imageView.addSymbolEffect(.bounce, options: .repeating)
		}

completion handler on hide

Great work, thanks for making it available! This thing is sweet.

One minor feature request. It would be nice to get a callback after the if hide timer, since I typically have to take some action on my end. For example, I want to show "Success!" for 1.5 seconds and then dismiss my modal vc. The builtin hiding delay is thoughtful but I can't take advantage of it without a completion handler.

Typical flow:

  1. show hud for at least one second even if network request is quite fast
  2. show "Success!" for 1.5 seconds to give user a chance to read
  3. hide hud & dismiss view controller

Does this HUD support `.clear` background color?

I figured out these properties didn't work when setting UIColor.clear. It's still showing a black background color. Are there any changes to make it transparent?

ProgressHUD.colorBackground = .clear
ProgressHUD.colorHUD = .clear

Simulator Screenshot - iPhone 15 Pro - 2023-12-13 at 19 19 09

ProgressHUD not working in 13.8.1 and up

Progress views do not appear anymore. Seemingly starting from version 13.8.1

ProgressHUD.show("testing")

does nothing anymore, at least testing on an iOS 17 simulator iPad. Same code worked before and does so with 13.8.0

Could it be related to "Added multi-window support: custom window can be defined now."?

"Full" code:

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        ProgressHUD.show("Testar")
    }

if dismiss and then show again immediately , it will not show.

    ProgressHUD.show()
  
    DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 2) {

        ProgressHUD.dismiss()
        
        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.04) {
            ProgressHUD.showError()
        }
      // DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.05) {
        //    ProgressHUD.showError()
        // }
    }

if i want show again ,i should set greater than 0.05 TimeInterval ,otherwise is will not show .

Multi-window support

Sometimes we need to show activity indicator on screen that presented in separate window. Currently there is no possibility to set the right window for this purpose.
Code takes current first window, or create one now.
Also please consider windowLevel when creating a new window, it should be between .normal and .alert

cocoapods can't be use

pod install
Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "ProgressHUD":
In Podfile:
ProgressHUD (~> 13.7.2)

Specs satisfying the ProgressHUD (~> 13.7.2) dependency were found, but they required a higher minimum deployment target

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.