Latest 0.1.3
License MIT
Platforms ios 8.0




To run the example project, clone the repo, and run pod install from the Example directory first.


  • Swift 2.0


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

pod "CountDownLabel"


Martin Kluska, [email protected]


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


Import the module

import CountDownTimeAgoLabel

When the date is set to label/countdown objects, the timer will start (if the formatter is set). You can create CountDown object for a custom UI or you can create a CountDownLabel with automatic text updating

Via own delegate

let countDown = CountDown(aDelegate: self) = NSDate(...)

func countDownChanged(countDown: CountDown, format: String) {
    testLabel.text = format

Via label (code)

let label = CountDownLabel(frame: CGRectZero)
label = NSDate(...)

Manualy start the timer

let countDown = CountDown(aDelegate: self)
countDown.autoStartOnDate = false = NSDate(...)

Formattes styles (with CountDownBaseFormatter)

In default uses the CountDownBaseFormatter with custom styles for date or time.

You can set it by accessing the formatter object.

let formatter = countDown.formatter as? CountDownBaseFormater
formatter?.dateStyle = .Full // this value is default
formatter?.timeStyle = .Full // this value is default


Renders the part of date/time in given style

  • .Full: Shows full style with localized string: 2 seconds
  • .ISO: Shows the ISO format: 12:30:23
  • .Short: Shows the shorten version of string: 2m 2s
  • .None: The rendering is skipped

CountDown logic

You can set the logic how the label is rendered by setting the countDown.logic


  • .Static: Show only current time diff in selected format
  • .CountDown: Count downs to the end date
  • .Automatic: Supports future/past diff times

IB Interface

Drag a UILabel to your view and set the class to CountDownLabel. In your attributes tab you can change the
settings for the label. This will change the countdowns properties.

You can access the labels CountDown object via label.countDown.


  • automatic
  • static
  • countdown


  • full
  • iso
  • short
  • none


You can set:

  • date
  • timeInterval for the timer
  • autoStartOnDate to turn on/off automatic start on date set
  • formatter for formatting the date
  • delegate to respond on changes
  • logic to decide which timer logic to use
  • finishedMessage to customize the finish text
  • hasFinished

You can call:

  • start() to create timer and trigger formating
  • stop() to end the timer
  • currentFormat() to return current text
  • updateCountDown to trigger update


You can set:

  • date to set the starting date and trigger start
  • onFinishBlock to handle the finish of the countdown
  • prefixText and suffixText to add custom text format, must add a space if desired

You can call:

All UILabel methods, also you can access to the countDown instance via label.countDown


  • update readme with how to
  • change the example project
  • add suport for "ago" text with custom stringsdict (becouse of czech language)
  • add more languages
  • add custom ISO formats
  • unit tests


You can create a custom style logic for the base formatter (CountDownBaseFormatter) by using CountDownStyleProtocol or you can create your own formatter via protocol CountDownFormatProtocol


Are welcome :)

Latest podspec

    "name": "CountDownTimeAgoLabel",
    "version": "0.1.3",
    "summary": "CountDown logic via custom label. You can use use own view implementation via CountDown class usage",
    "description": "Enables using cound down logic on label or any custom UI. The CountDownLabel is ready to be designed in the the interface.nnSupports multiple styles for formatting with ability to set custom formatter. Supports also counting 'ago' time.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Martin Kluska": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.3"
    "social_media_url": "",
    "platforms": {
        "ios": "8.0"
    "source_files": "CountDownLabel/Classes/**/*",
    "resource_bundles": {
        "CountDownLabel": [

Pin It on Pinterest

Share This