Giter VIP home page Giter VIP logo

hpgradientloading's Introduction

HPGradientLoading

Platform Language Version License Issues Build codecov

HPGradientLoading is awesome library for loading activity in iOS application

sample

Installation

CocoaPods

pod 'HPGradientLoading'

Manually

Copy the HPGradientLoading folder to your project.

Conguration

  • Enable blur background
var isBlurBackground: Bool
  • Enable blur loading activity
var isBlurLoadingActivity: Bool
  • Enable dismiss loading when tap
var isEnableDismissWhenTap: Bool
  • Size of loading activity
var sizeOfLoadingActivity: CGFloat
  • Gradient from color
var fromColor: UIColor
  • Gradient to color
var toColor: UIColor
  • Duration animation
var durationAnimation: TimeInterval
  • Blur color tinr loading activity
var blurColorTintActivity: UIColor
  • Blur color tint alpha for loading activity
var blurColorTintAlphaActivity: CGFloat
  • Blur radius loading activity
var blurRadiusActivity: CGFloat
  • Corner radius for loading activity
var cornerRadiusActivity: CGFloat
  • Gradient line width for loading activity
var gradientLineWidth: CGFloat
  • Blur color tint for background
var blurColorTintBackground: UIColor
  • Blur color tint alpha for background
var blurColorTintAlphaBackground: CGFloat
  • Blur radius background
var blurRadiusBackground: CGFloat
  • Color for title loading
var colorTitleLoading: UIColor
  • Font for title loading
var fontTitleLoading: UIFont
  • Color for processing loading
var colorTitleProcessing: UIColor
  • Font for title processing
var fontTitleProcessing: UIFont

Actions

  • Show loading
func showLoading(with title: String? = nil)
  • Show processing
func showProcessing(with loadingTitle: String? = nil, percent: CGFloat, duration: TimeInterval = 0.1)
  • Update processing
func updateProcessing(with percent: CGFloat, duration: TimeInterval = 0.1)
  • Dismiss loading
func dismiss()

Usage

Setup

Add import HPGradientLoading in your file

import UIKit
import HPGradientLoading

class ViewController: UIViewController {


    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        HPGradientLoading.shared.configation.isEnableDismissWhenTap = true
        HPGradientLoading.shared.configation.isBlurBackground = true
        HPGradientLoading.shared.configation.durationAnimation = 1.0
        HPGradientLoading.shared.configation.fontTitleLoading = UIFont.systemFont(ofSize: 20)

    }

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        HPGradientLoading.shared.dismiss()
    }


    // MARK: - Actions
    @IBAction private func showLoadingWithTitle(_ sender: Any) {
        HPGradientLoading.shared.showLoading(with: "Loading...")
    }

    @IBAction private func showLoadingWithEmptyTitle(_ sender: Any) {
        HPGradientLoading.shared.showLoading()
    }

    @IBAction private func showProcessing(_ sender: Any) {
        self.percent = 0
        HPGradientLoading.shared.showProcessing(with: "Loading...", percent: self.percent, duration: 0.15)
        self.timer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true, block: { (timer) in
            self.percent += 4
            self.percent = self.percent > 100 ? 100 : self.percent
            HPGradientLoading.shared.updateProcessing(with: self.percent)
            if self.percent == 100 {timer.invalidate()}
        })
    }
}

Requirements

Swift 5.0

iOS 10.0+

Xcode 10.2+

Contributing

Forks, patches and other feedback are welcome.

Creator

HPGradientLoading

Quang Hoang

Blog

License

HPGradientLoading is available under the MIT license. See the LICENSE file for more info.

hpgradientloading's People

Stargazers

 avatar Manh Pham Van (Opn VN - Dev Manager) avatar Jesse Anderson avatar Money Chien avatar Phan Quang Hoang avatar

Watchers

James Cloos avatar Phan Quang Hoang avatar

hpgradientloading's Issues

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.