Giter Site home page Giter Site logo

zvprogresshud's Introduction

ZVProgressHUD

Carthage compatible CocoaPods Compatible Platform

ZVProgressHUD is a pure-swift and wieldy HUD.

中文文档

Requirements

  • iOS 8.0+
  • Swift 5.0

Appetize

You can run this demo at Appetize

Installation

Cocoapod

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

You can install Cocoapod with the following command

$ sudo gem install cocoapods

To integrate ZVProgressHUD into your project using CocoaPods, specify it into your Podfile

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target 'TargetName' do
    use_frameworks!
    pod 'ZVProgressHUD', '~> 2.0.0'
end

Then,install your dependencies with CocoaPods.

$ pod install

Carthage

Carthage is intended to be the simplest way to add frameworks to your application.

You can install Carthage with Homebrew using following command:

$ brew update
$ brew install carthage

To integrate ZVProgressHUD into your project using Carthage, specify it into your Cartfile

github "zevwings/ZVProgressHUD" ~> 0.0.1

Then,build the framework with Carthage using carthage update and drag ZVProgressHUD.framework into your project.

Note:

The framework is under the Carthage/Build, and you should drag it into Target -> Genral -> Embedded Binaries

Usage

You can use import ProgressHUD when you needed to use ZVProgressHUD.

Showing a HUD

When you start a task, You can using following code:

// class method
ProgressHUD.shared.show()
// or you can use instance method 
let hud = ProgressHUD()
hud.show()

you can custom animation type, use following code:

/// the animation type, default is flat
public enum AnimationType {
	case flat		
	case native	
}

/// this code will modify global animation type.
ProgressHUD.shared.animationType = .flat

when you want modify the superview of ZVProgressHUD, use the following code:

// the HUD will show delay 0.0
ZVProgressHUD.show(with: "Loading", in: superview, delay: 0.0)

Dismiss a HUD

you can use a simple code to close HUD.

// class method
ProgressHUD.shared.dismiss()
// or you can use instance method 
hud.dismiss()

Showing a confirm

when you want show a comfirm infomation, use the following code:

ProgressHUD.shared.showError(with: "error")
ProgressHUD.shared.showSuccess(with: "success")
ProgressHUD.shared.showWarning(with: "warning")

Showing a custom image

you also can show a custom image, use the following code:

let image = UIImage(named: "smile")
ProgressHUD.shared.showImage(image!)
// or
ProgressHUD.shared.showImage(image!, title: "smile everyday!")

Showing a custom animation

you can use the following code to custom a animation indicator.

var images = [UIImage]()
for index in 1 ... 3 {
    let image = UIImage(named: "loading_0\(index)")
    images.append(image!)
}

ProgressHUD.shared.showAnimation(images)

Showing a progress

ProgressHUD.shared.showProgress(0.0, title: "Progress")

Custom logo

// set logoSize of HUD, CGSize(30, 30)
class var logoSize: CGSize 
// set logo image of HUD, default is nil
class var logo: UIImage 

Custom properties

// set displayStyle type of HUD, default is dark.
class var displayStyle: DisplayStyle 

// set mask type of HUD
class var maskType: MaskType 

// the cornerRadius of basic view   
class var cornerRadius: CGFloat 

// the offset of basic view
class var offset: UIOffset 

// the font of title label
class var font: UIFont 

// you can change the line width of indicator when animation type is `flat`
class var strokeWith: CGFloat 

// the size of indicator
class var indicatorSize: CGSize 

// the animation type, default is `flat`
class var animationType: IndicatorView.AnimationType 

Custom Insets of content

class var contentInsets: UIEdgeInsets 

class var titleEdgeInsets: UIEdgeInsets 

class var indicatorEdgeInsets: UIEdgeInsets 

Notifications

you can add an observer to do something from hud's notifications.

extension NSNotification.Name {
	
	 // this hud did disappear
    public static let ProgressHUDReceivedTouchUpInsideEvent: Notification.Name

	 // this hud will appear
    public static let ProgressHUDWillAppear: Notification.Name

	 // this hud did appear
    public static let ProgressHUDDidAppear: Notification.Name

	 // this hud will disappear
    public static let ProgressHUDWillDisappear: Notification.Name

	 // this hud did disappear
    public static let ProgressHUDDidDisappear: Notification.Name
}

License

ZVProgressHUD distributed under the terms and conditions of the MIT License

zvprogresshud's People

Contributors

dependabot[bot] avatar zevwings 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

zvprogresshud's Issues

Progress Number

Is it possible to include a progress number inside of the progress circle?

Dependency "ZVProgressHUD" has no shared framework schemes for any of the platforms: iOS

*** Cloning AlamofireImage
*** Cloning ZVProgressHUD
*** Cloning SnapKit
*** Cloning SwiftyJSON
*** Cloning Alamofire
*** Checking out Alamofire at "4.8.2"
*** Checking out SwiftyJSON at "4.3.0"
*** Checking out SnapKit at "4.2.0"
*** Checking out ZVProgressHUD at "0.0.2"
*** Checking out AlamofireImage at "3.5.2"
*** xcodebuild output can be found in /var/folders/f3/lsvwk9b125q5w2mhrpj54__80000gn/T/carthage-xcodebuild.gjNf3B.log
*** Building scheme "Alamofire iOS" in Alamofire.xcworkspace
*** Building scheme "AlamofireImage iOS" in AlamofireImage.xcworkspace
*** Building scheme "SnapKit" in SnapKit.xcworkspace
*** Building scheme "SwiftyJSON iOS" in SwiftyJSON.xcworkspace
*** Skipped building ZVProgressHUD due to the error:
Dependency "ZVProgressHUD" has no shared framework schemes for any of the platforms: iOS

If you believe this to be an error, please file an issue with the maintainers at https://github.com/zevwings/ZVProgressHUD/issues/new
nijiadeMBP:myapp nijia$

Error in Xcode 11 with SwiftPM integration

I tried to add ZVProgressHUD with SwiftPM integration in Xcode 11, but got an error while compiling.

Use of undeclared type 'UIView'

Screen Shot 2019-10-13 at 10 00 50

ZVProgressHUD works fine using Carthage. Please look into it. Thank you.

SPM Warnings

Hey @zevwings ,

can you update platform version to - platforms: [.iOS(.v9)]?

The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99.

same issue for ZVActivityIndicatorView

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.