CocoaPods trunk is moving to be read-only. Read more on the blog, there are 17 months to go.

APECountdownView 0.1.2

APECountdownView 0.1.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Feb 2016
SPMSupports SPM

Maintained by Daniel Nilsson.



 
Depends on:
RxSwift~> 2.2
RxCocoa~> 2.2
 

APECountdownView

A simple and easy count down view.

Countdown

Requirements

  • iOS 8 or later.
  • Xcode 7 or later.

Installation

Usage interface builder

  • Drag a UIView into your storyboard (or nib file).
  • Change class to CountdownView.
  • You can now modify the appearance directly from Interface builder. screenshot

Usage code

Don’t forget to import.

import APECountdownView

Connect your countDownView from interface builder

@IBOutlet weak var countdownView: CountdownView!

Start the countdown

let days = 86400000.0 * 20  // 20 days
let hours = 3600.0 * 20     // 20 hours
let minutes = 60.0 * 20     // 20 minutes
let seconds = 1.0 * 20      // 20 seconds

let endDate = NSDate(timeIntervalSinceNow: days + hours + minutes + seconds)
countdownView.startCountdown(endDate, onCompleted: { _ in
    print("Countdown completed!")
})

Change appearance

countdownView.size = CGSize(width: 30, height: 40)
countdownView.groupSpace = -3
countdownView.sectionSpace = 3
countdownView.gradientColor1 = UIColor(red: 0.290, green: 0.290, blue: 0.290, alpha: 1.000)
countdownView.gradientColor2 = UIColor(red: 0.153, green: 0.153, blue: 0.153, alpha: 1.000)
countdownView.gradientColor3 = UIColor(red: 0.071, green: 0.071, blue: 0.071, alpha: 1.000)
countdownView.gradientColor4 = UIColor(red: 0.004, green: 0.004, blue: 0.004, alpha: 1.000)
countdownView.blockFont = UIFont.boldSystemFontOfSize(16)
countdownView.blockFontColor = UIColor.whiteColor()
countdownView.titleFont = UIFont.systemFontOfSize(10)
countdownView.titleFontColor = UIColor.blackColor()

Contributing

All people are welcome to contribute. See CONTRIBUTING for details.

License

APECountdownView is released under the MIT license. See LICENSE for details.