Coder Social home page Coder Social logo

quick-ticker's Introduction

A Swift library for animating labels and text fields

Version License Platform Swift 4

Installation

Manually:

Simply copy the QuickTicker.Swift file to your project (it is located in QuickTicker > Classes)

Cocoapods:

QuickTicker is also available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'QuickTicker'

Features

  • Simple syntax similar to UIView's animate methods
  • It works even if there is text mixed in with numbers in the same label. Text remains intact while the digits get animated!
  • Works on both UILabels and UITextFields, and accepts any Numeric value (no need to type cast or convert)
  • Completion handler lets you safely queue-up actions following the animation
  • You can optionally specify animation curves and decimal points for the label
  • Completely safe to destroy or deallocate your label mid-animation, no strong reference is kept
  • Unit tested and checked for memory leaks

Quick Functions

You can get started with a simple one line function call

QuickTicker.animate(label: textLabel, toEndValue: 250)

The default duration is 2 seconds, but that can be easily changed

QuickTicker.animate(label: textLabel, toEndValue: 250, duration: 4.3)

You can also specify the animation curve

QuickTicker.animate(label: textLabel, toEndValue: 250, options: [.easeOut])

Advanced Quick Ticker

You can optionally specify the duration, the animation curve, decimal points, and add a completion handler to be executed at the end of the animation.

QuickTicker.animate(label: textLabel, toEndValue: 250, duration: 4.3, options: [.easeOut, .decimalPoints(2)], completion: {
                        print("Ticker animation done!")
                    })

Compatible Types

Enter any of the following types as the end value for the animation, no need to type cast!

  • CGFloat
  • Float
  • Double
  • Int
  • UInt
  • Int8
  • UInt8
  • Int16
  • UInt16
  • Int32
  • UInt32
  • Int64
  • UInt64

What it looks like

Sample App:

InstaWeather:

Find My Latte:

Find My Latte:

Try it!

To run the example project, clone the repo, and launch QuickTicker.xcworkspace from the Example directory.

Requirements

  • iOS 9.0+
  • Swift 4.2 (you can run it on 4.0 by changing the CADisplayLink api call, one line of code)
  • Xcode 10 (same as above to run on older Xcode)

Author

Besher Al Maleh โ€“ [email protected]

Distributed under the MIT license. See LICENSE for more information.

https://github.com/almaleh/github-link
LinkedIn

Contributing

Contributors are welcome!

  1. Fork it (https://github.com/almaleh/Quick-Ticker/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

quick-ticker's People

Contributors

almaleh avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

nirajcapermint

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.