Coder Social home page Coder Social logo

mdeora / nvactivityindicatorview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ninjaprox/nvactivityindicatorview

0.0 1.0 0.0 5.79 MB

A collection of awesome loading animations

License: MIT License

Swift 98.36% Ruby 0.68% Objective-C 0.81% Shell 0.14%

nvactivityindicatorview's Introduction

NVActivityIndicatorView

Build Status Cocoapods Compatible Carthage Compatible Reviewed by Hound

Introduction

NVActivityIndicatorView is a collection of awesome loading animations.

This is original a fork from DGActivityIndicatorView, inspired by Loaders.css, written in Swift with full implementation of animations, plus more.

You can also find Objective-C version of this here.

Demo

alt tag

For first-hand experience, just open the project and run it.

Animation types

Type Type Type Type
1. ballPulse 2. ballGridPulse 3. ballClipRotate 4. squareSpin
5. ballClipRotatePulse 6. ballClipRotateMultiple 7. ballPulseRise 8. ballRotate
9. cubeTransition 10. ballZigZag 11. ballZigZagDeflect 12. ballTrianglePath
13. ballScale 14. lineScale 15. lineScaleParty 16. ballScaleMultiple
17. ballPulseSync 18. ballBeat 19. lineScalePulseOut 20. lineScalePulseOutRapid
21. ballScaleRipple 22. ballScaleRippleMultiple 23. ballSpinFadeLoader 24. lineSpinFadeLoader
25. triangleSkewSpin 26. pacman 27. ballGridBeat 28. semiCircleSpin
29. ballRotateChase 30. orbit 31. audioEqualizer 32. circleStrokeSpin

Installation

Cocoapods

Install Cocoapods if need be.

$ gem install cocoapods

Add NVActivityIndicatorView in your Podfile.

use_frameworks!

pod 'NVActivityIndicatorView'

If you're using NVActivityIndicatorView in an app extension, use NVActivityIndicatorView/AppExtension instead.

use_frameworks!

pod 'NVActivityIndicatorView/AppExtension'

Then, run the following command.

$ pod install

Note: Please refer to the migration note for version 3.7.0 below.

Carthage

Install Carthage if need be.

$ brew update
$ brew install carthage

Add NVActivityIndicatorView in your Cartfile.

github "ninjaprox/NVActivityIndicatorView"

Run carthage to build the framework and drag the built NVActivityIndicatorView.framework in the folder appropriateto the platform, e.g. iOS, tvOS, into your Xcode project.

Note: You might encounter compile issue, if so please use carthage branch instead. Check issue #101 for more information.

Manual

Copy NVActivityIndicatorView folder to your project. That's it.

Note: Make sure that all files in NVActivityIndicatorView included in Compile Sources in Build Phases.

Note: If you encounter issues while uploading the app to iTunes Connect, remove the Info.plist file in NVActivityIndicatorView. Check issue #129 for more information.

Migration

Version 4.4.0

This version requires Xcode 10.1 and Swift 4.2.

Version 4.0.0

This version requires Xcode 9.0 and Swift 4.

Version 3.7.0

This version splits NVActivityIndicatorView pod to 2 subpods NVActivityIndicatorView/Presenter and NVActivityIndicatorView/AppExtension. There is no need to change pod NVActivityIndicatorView to pod NVActivityIndicatorView/Presenter since it will be installed by default if you use the main pod name.

However, if you want to use NVActivityIndicatorView in an app extension, use pod NVActivityIndicatorView/AppExtension instead.

Note: Related issue #119.

Usage

Firstly, import NVActivityIndicatorView.

import NVActivityIndicatorView

Initialization

Then, there are two ways you can create NVActivityIndicatorView:

  • By storyboard, changing class of any UIView to NVActivityIndicatorView.

Note: Set Module to NVActivityIndicatorView.

  • By code, using initializer. All parameters other than frame are optional and NVActivityIndicatorView.DEFAULT_* are used as default values.
NVActivityIndicatorView(frame: frame, type: type, color: color, padding: padding)

Control

Start animating.

activityIndicatorView.startAnimating()

Stop animating.

activityIndicatorView.stopAnimating()

Determine if it is animating.

animating = activityIndicatorView.isAnimating

Change properties

In storyboard, you can change all properties in Attributes inspector tab of Utilities panel.

Note: Use one of values (case-insensitive) in Animation types for Type Name.

All properties are public so you can change them after initializing.

Note: All changes must be made before calling startAnimating().

UI blocker

By conforming NVActivityIndicatorViewable protocol, you can use NVActivityIndicatorView as UI blocker for UIViewController.

class ViewController: UIViewController, NVActivityIndicatorViewable { }

Start animating.

startAnimating(size, message) // plus other parameters as in initializer.

Stop animating.

stopAnimating()

Check if it is animating.

animating = isAnimating

Or you can use NVActivityIndicatorPresenter to display UI blocker anywhere.

Start animating.

let activityData = ActivityData()

NVActivityIndicatorPresenter.sharedInstance.startAnimating(activityData)

Note: Check documentation for detail of ActivityData.

Stop animating.

NVActivityIndicatorPresenter.sharedInstance.stopAnimating()

Change message.

NVActivityIndicatorPresenter.sharedInstance.setMessage("Done")

Check if it is animating.

animating = NVActivityIndicatorPresenter.sharedInstance.isAnimating

Fade in/out animation

You have control over showing and hiding UI blocker animation.

startAnimating(fadeInAnimation: fadeInAnimation)
stopAnimating(fadeOutAnimation)

Check DEFAULT_FADE_IN_ANIMATION and DEFAULT_FADE_OUT_ANIMATION for examples of how to implement animation.

Acknowledgment

Thanks Connor Atherton for great loaders and Danil Gontovnik for kick-start.

License

The MIT License (MIT)

Copyright (c) 2016 Vinh Nguyen @ninjaprox

nvactivityindicatorview's People

Contributors

131e55 avatar awalz avatar basememara avatar bennetlinden avatar bogdan-razvan avatar chrisbull avatar deepankvora avatar gregttn avatar jobinsjohn avatar jp26jp avatar kocmohabta avatar kwongius avatar loicgriffie avatar marvinnazari avatar matibzurovski avatar mnatsakanov avatar morizotter avatar msavisko avatar ninjaprox avatar ozgur avatar parkgwangbeom avatar quantum2 avatar rlester avatar salbertson avatar samjohn avatar spriter avatar tako3 avatar waterskier2007 avatar whitecl avatar winkelsdorf avatar

Watchers

 avatar

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.