Giter VIP home page Giter VIP logo

processloadingview's Introduction

ProcessLoadingView

Pod Version Pod License Language Swift version

ProcessLoadingView is a step indicator loading animation built using CABasicAnimation , where the user can nearly customize everything in it:
inspired from: https://dribbble.com/shots/1118077-Proces-animation

Features

  • light weight easy to setup.
  • completely customizable.
  • dynamic number of items can be set .
  • capability of setting custom locations of the items in the circumference .
  • ability to set different image for every item.
  • capability of setting different attributes regarding the colors, fonts and the speed of the progress.
Predfined locations in circumference Setting variable number of items (8)

Installation

CocoaPods

ProcessLoadingView is available on CocoaPods. Add the following to your Podfile:

pod 'ProcessLoadingView', '~> 0.1.2'

Manually

Just add the processView folder to your project.

Usage

(see sample Xcode project Demo) create a view in the storyboard and give it's class 'ProcessLoadingView' then connect an outlet to it.

Fast Setup

ProcessLoadingView can have variable number of items based on your need, you only need the following steps to get it runing:

1- put a UIView in your storyboard and give it a class ProcessLoadingView. Alt Text

2- connect an outlet to it, call it viewProcess

3- create options object and assign it to viewProcess :

let stepComplete = 3
let totalSteps = 4
        
var options = ProcessOptions()
options.setNumberOfItems(number: totalSteps)
options.images = [(img1, nil), (img2, nil), (img3, nil), (img4, nil)]
options.stepComplete = stepComplete
options.bgColor = bgColor
viewProcess.options = options

note

  • set the number of process steps through options's setNumberOfItems method.
  • options.images should be assigned an array it's count equals to the total number of steps.

Full customization of processView

//totalSteps: adding 8 process items, this number can be increased or decreased ;) 
let totalSteps = 8
var options = ProcessOptions()
options.setNumberOfItems(number: totalSteps)
options.stepComplete = 3
options.inSpeed = 1.2
options.images = imageOpts(of: step, totalSteps: totalSteps)
options.mainTextfont = UIFont.boldSystemFont(ofSize: 22)
options.subTextfont = UIFont.boldSystemFont(ofSize: 16)
options.ItemSize = 30
options.radius = 120
options.bgColor = bgColor
options.completedPathColor = colorBlue
options.mainTextColor = .white
options.subTextColor = colorOrange
        
viewProcessOutlet.options = options

If you want a custom places on the circle shape, do not use this method :

options.setNumberOfItems(number: totalSteps)

and use:

var options = ProcessOptions()
let curvesStartRadians = [(3 * CGFloat.pi)/2, (23 * CGFloat.pi) / 12, (CGFloat.pi / 3), ((2 * CGFloat.pi) / 3), (13 * CGFloat.pi) / 12]
let curvesEndRadians   = [(23 * CGFloat.pi) / 12, (CGFloat.pi) / 3, (2 * CGFloat.pi) / 3, (13 * CGFloat.pi) / 12, (3 * CGFloat.pi)/2]

options.curvesStartRadians = curvesStartRadians
options.curvesEndRadians = curvesEndRadians

options.stepComplete = 3
options.inSpeed = 1.2
options.images = imageOpts(of: step, totalSteps: curvesStartRadians.count)
options.mainTextfont = UIFont.boldSystemFont(ofSize: 22)
options.subTextfont = UIFont.boldSystemFont(ofSize: 16)
options.ItemSize = 30
options.radius = 120
options.bgColor = bgColor
options.completedPathColor = colorBlue
options.mainTextColor = .white
options.subTextColor = colorOrange
        
viewProcessOutlet.options = options

To get the locations in the circle circumference:

Alt Text

ProcessView action methods

To start Animation:

viewProcess.start(completed:
{
     //code to run after finishing
})

Reverse animation without removing the items:

viewProcess.reset(removeItems: false)
{
     //code to run after finishing
}

Reverse animation then removing the items:

viewProcess.reset(removeItems: true)
{
     //code to run after finishing
}

License

This code is distributed under the terms and conditions of the MIT license.

processloadingview's People

Contributors

ayman-ibrahim avatar legoless 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

processloadingview's Issues

Crashing When displaying on screen

Im displaying the view programmatically in one of my views as a progress indicator for when data is being downloaded. When I display the view the code keeps crashing on this line textLayerParent.position = self.myCenter in the preparation method. Any idea why?

Impossible to add to a project ..

I used cocoapods,
Then I add a view, class ProcessLoadingView
Then, import ProcessLoadingView
Then, @IBOutlet var viewProcess: ProcessLoadingView!

and I still having this error : "Use of undeclared type 'ProcessLoadingView'"

I can't fix it, please help me

Thanks

Hi!

I cant make the background color clear in ProcessLoadingView, how can i fix this?

The control is too raw yet

you peg it as something like "progress view". Ok, could you provide a clear way how to set the progress. In other controls you just set one variable from 0 to 100 percent and progress redraws by itself. But not in your case

How to change the images with viewcontroller progress?

Assalamualikum,
This is amazing work. But I want only four image and they change their position based on viewcontroller progress. Example I have a bottomsheet view controller with circular progress bar when user start sliding up then the images over the progress bar change their position.

Here is the video link that i want to create. How to achieve this.
I badly need your help.
May Allah bless you.

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.