Giter VIP home page Giter VIP logo

countdownview's Introduction

CountdownView

CocoaPods Compatible

Preview

Installation

Disclaimer note that came after 3 years: I would not suggest to actually use this. It was mostly a learning experience. In case you are trying to build something similar and trying to find a starting point, I would advise just checking the animation implementation part.

If you want to use it anyway, you can just add the CountdownView folder to your project.

Usage

  1. use the basic show method or the one with completion block and automatic hiding
CountdownView.show(countdownFrom: Double, spin: Bool, animation: Animation)
CountdownView.show(countdownFrom: Double, spin: Bool, animation: Animation, autoHide: Bool, completion: (()->())?)
  1. hide if you didn't use auto hiding
CountdownView.hide(animation: Animation, options: (duration: Double, delay: Double), completion: (()->())?)

Animation options

  • fadeIn
  • fadeOut
  • fadeInLeft
  • fadeInRight
  • fadeOutLeft
  • fadeOutRight
  • zoomIn
  • zoomOut

Customizing

You can access the properties below from CountdownView's shared instance before you call the show function as you can see in the example and customize it any way you like and need.

Example

CountdownView.shared.frameSize = CGSize(width: 200.0, height: 200.0)

CountdownView.shared.backgroundViewColor = UIColor.cyan

CountdownView.shared.dismissStyle = .byTapOnOutside
 
CountdownView.show(countdownFrom: Double, spin: Bool, animation: Animation)

All properties

public var dismissStyle: DismissStyle
public var dismissStyleAnimation: Animation

public var frameSize: CGSize
public var framePosition: CGPoint

public var backgroundViewColor: UIColor

public var counterViewBackgroundColor: UIColor
public var counterViewShadowColor: UIColor
public var counterViewShadowRadius: CGFloat
public var counterViewShadowOpacity: Float

public var spinnerLineWidth: CGFloat
public var spinnerInset: CGFloat
public var spinnerStartColor: UIColor
public var spinnerEndColor: UIColor
public var colorTransition: Bool 

public var counterLabelFont: UIFont
public var counterLabelTextColor: UIColor

public var counterSubLabelText: String
public var counterSubLabelFont: UIFont
public var counterSubLabelTextColor: UIColor  

public var closeButtonTitleLabelText: String
public var closeButtonTitleLabelFont: UIFont
public var closeButtonTitleLabelColor: UIColor
public var closeButtonTopAnchorConstant: CGFloat
public var closeButtonLeftAnchorConstant: CGFloat
public var closeButtonImage: UIImage
public var closeButtonTintColor: UIColor

Requirements

  • iOS 9.0+
  • Swift 3+

License

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

countdownview's People

Contributors

knishihara avatar sarimashfaq avatar ta-999 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

Watchers

 avatar  avatar  avatar

countdownview's Issues

dismiss the view by clicking

I absolutely LOVE this library, awesome job!

I have it all set up but I would like to be able to dismiss it by pressing anywhere on the screen, or maybe adding an X button. Is this possible?

Thanks!

Issue building: Fatal Error

Getting 'Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value' as an error when attempting to build with a CountdownView in the view. Line 41: " public var framePosition = UIApplication.shared.keyWindow!.center" is the one causing problems.

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.