All Projects → suzuki-0000 → Countdownlabel

suzuki-0000 / Countdownlabel

Licence: mit
Simple countdown UILabel with morphing animation, and some useful function.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Countdownlabel

React Timer Hook
React timer hook
Stars: ✭ 118 (-83.47%)
Mutual labels:  timer, countdown
CountdownTimer-TeLeTiPs
The very first powerful Telegram bot to countdown to your important events in any group chat. Live countdown timer (days : hours : minutes : seconds)
Stars: ✭ 122 (-82.91%)
Mutual labels:  countdown, timer
Flipdown
⏰ A lightweight and performant flip styled countdown clock
Stars: ✭ 136 (-80.95%)
Mutual labels:  timer, countdown
Countdowntask
⌛️A countdown library for Android.
Stars: ✭ 64 (-91.04%)
Mutual labels:  timer, countdown
alfred-timer-workflow
Alfred workflow to start a timer, which blinks when the time is up.
Stars: ✭ 39 (-94.54%)
Mutual labels:  countdown, timer
Flip Clock
A flip clock, timer and countdown made with Polymer
Stars: ✭ 69 (-90.34%)
Mutual labels:  timer, countdown
React Countdown Circle Timer
Lightweight React/React Native countdown timer component with color and progress animation based on SVG
Stars: ✭ 220 (-69.19%)
Mutual labels:  timer, countdown
React Native Countdown Component
React Native CountDown
Stars: ✭ 193 (-72.97%)
Mutual labels:  timer, countdown
use-countdown-timer
React hook exposing a countdown timer with optional expiration reset callbacks
Stars: ✭ 31 (-95.66%)
Mutual labels:  countdown, timer
tiny-timer
🕑 Small countdown timer and stopwatch module.
Stars: ✭ 39 (-94.54%)
Mutual labels:  countdown, timer
React Countdown
React Component showing a countdown to certain date and time.
Stars: ✭ 58 (-91.88%)
Mutual labels:  timer, countdown
Web-Time-Tracker
Plugin named Timetracker is a time counter that works in both increase and decrease directions.
Stars: ✭ 21 (-97.06%)
Mutual labels:  countdown, timer
Termdown
Countdown timer and stopwatch in your terminal
Stars: ✭ 749 (+4.9%)
Mutual labels:  timer, countdown
Use Timer
A timer hook for React
Stars: ✭ 113 (-84.17%)
Mutual labels:  timer, countdown
react-timer-wrapper
Composable React Timer component that passes status props to children, in addition to some basic callbacks. Can be used at a countdown timer ⏲ or as stopwatch ⏱ to track time while active.
Stars: ✭ 14 (-98.04%)
Mutual labels:  countdown, timer
react-component-countdown-timer
This is a simple count down timer react component.
Stars: ✭ 18 (-97.48%)
Mutual labels:  countdown, timer
Easytimer.js
Easy to use Timer/Stopwatch/Countdown library compatible with AMD, ES6 and Typescript
Stars: ✭ 562 (-21.29%)
Mutual labels:  timer, countdown
Laravel S
LaravelS is an out-of-the-box adapter between Swoole and Laravel/Lumen.
Stars: ✭ 3,479 (+387.25%)
Mutual labels:  timer
Mob
Tool for swift git handover.
Stars: ✭ 418 (-41.46%)
Mutual labels:  timer
Oycountdownmanager
在cell中使用倒计时的处理方法, 全局使用一个NSTimer对象, 支持单列表.多列表.多页面.分页列表使用
Stars: ✭ 317 (-55.6%)
Mutual labels:  countdown

CountdownLabel

Swift Carthage Compatible CocoaPods Compatible

Simple countdown UILabel with morphing animation, and some useful function.

sample

features

  • Simple creation
  • Easily get status of countdown from property and delegate.
  • Insert some of function, and completion
  • Style change as usual as UILabel do
  • Morphing animation from LTMorphingLabel.
  • XCTest assertion

Version vs Swift version.

Below is a table that shows which version of what you should use for your Swift version.

Swift version version
4.2 >= 4.0
4.0, 4.1 >= 3.0
3.X >= 2.0
2.3 1.3

Usage

You need only 2 lines.

// from current Date, after 30 minutes.
let countdownLabel = CountdownLabel(frame: frame, minutes: 30) // you can use NSDate as well
countdownLabel.start()

Morphing example

Use animationType. Those effect comes from LTMorphingLabel.

let countdownLabel = CountdownLabel(frame: CGRectZero, time: 60*60)
countdownLabel.animationType = .Pixelate
countdownLabel.start()
morphing effect example
.Burn sample
.Evaporate sample
.Fall sample
.Pixelate sample
.Scale sample
.Sparkle sample

Style

you can directly allocate it as a UILabel property just like usual.

countdownLabel.textColor = .orangeColor()
countdownLabel.font = UIFont(name:"Courier", size:UIFont.labelFontSize())
countdownLabel.start()

sample

Get Status of timer

there's some property for reading status.

countdownLabel.timeCounted      // timer that has been counted
countdownLabel.timeRemaining    // timer's remaining

// example
@IBAction func getTimerCounted(sender: UIButton) {
    debugPrint("\(countdownLabel.timeCounted)")
}

@IBAction func getTimerRemain(sender: UIButton) {
    debugPrint("\(countdownLabel.timeRemaining)")
}

sample

Control countdown

You can pause, start, change time.

// check if pause or not
if countdownLabel.isPaused {
    // timer start
    countdownLabel.start()
} else {
    // timer pause
    countdownLabel.pause()
}
// -2 minutes for ending
@IBAction func minus(btn: UIButton) {
    countdownLabel.addTime(-2)
}
    
// +2 minutes for ending
@IBAction func plus(btn: UIButton) {
    countdownLabel.addTime(2)
}

sample

Insert Function

Using then function or delegate, you can set your function anywhere you like.

// then property 
countdownLabel.then(10) { [unowned self] in
    self.countdownLabel.animationType = .Pixelate
    self.countdownLabel.textColor = .greenColor()
}
countdownLabel.then(5) { [unowned self] in
    self.countdownLabel.animationType = .Sparkle
    self.countdownLabel.textColor = .yellowColor()
}
countdownLabel.start() {
    self.countdownLabel.textColor = .whiteColor()
}

// delegate
func countingAt(timeCounted timeCounted: NSTimeInterval, timeRemaining: NSTimeInterval) {
    switch timeRemaining {
    case 10:
        self.countdownLabel6.animationType = .Pixelate
        self.countdownLabel6.textColor = .greenColor()
    case 5:
        self.countdownLabel6.animationType = .Sparkle
        self.countdownLabel6.textColor = .yellowColor()
    default:
        break
    }
}
func countdownFinished() {
    self.countdownLabel.textColor = .whiteColor()
}

sample

Attributed Text

you can set as attributedText too. note:but morphing animation will be disabled.

countdownLabel.setCountDownTime(30)
countdownLabel.timeFormat = "ss"
countdownLabel.countdownAttributedText = CountdownAttributedText(text: "timer HERE in text", replacement: "HERE")
countdownLabel.start() 

sample

Format

Don't specified over 24 hours or you'll get wrong format. CountdownLabel uses 00:00:00 (HH:mm:ss) as default format. if you prefer using another format, Your can set your time format like below.

countdownLabel.timeFormat = @"mm:ss"

Scheduled

you can set scheduled timer

// after 10 minutes will start a countdown from 20.
let fromDate   = NSDate().dateByAddingTimeInterval(10)
let targetDate = fromDate.dateByAddingTimeInterval(20)
let countdownLabel = CountdownLabel(frame: CGRectZero, fromDate: fromDate, targetDate: targetDate)
countdownLabel.start()

Check Status

some public properties are useful.

countdownLabel.isCounting      // check timer is counting now
countdownLabel.isPaused        // check timer was stopped
countdownLabel.isFinished      // check timer has ended
countdownLabel.morphingEnabled // check morphing is enabled

Requirements

  • iOS 9.0+
  • Swift 2.3+
  • ARC

##Installation

####CocoaPods available on CocoaPods. Just add the following to your project Podfile:

pod 'CountdownLabel'
use_frameworks!

####Carthage To integrate into your Xcode project using Carthage, specify it in your Cartfile:

github "suzuki-0000/CountdownLabel"

Inspirations

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].