Skip to content

Instantly share code, notes, and snippets.

@JadenGeller
Created August 23, 2015 05:59
Show Gist options
  • Save JadenGeller/0986833e6fff17cb6e3a to your computer and use it in GitHub Desktop.
Save JadenGeller/0986833e6fff17cb6e3a to your computer and use it in GitHub Desktop.
Emoji Clock from NSDate πŸ•›
extension NSDate {
var emojiDescription: Character {
let components = NSCalendar.currentCalendar().components(.CalendarUnitHour | .CalendarUnitMinute, fromDate: self)
let clockHour = components.hour % 12
let isSecondHalfOfHour = components.minute >= 15 && components.minute < 45
switch (clockHour, isSecondHalfOfHour) {
case (0, false): return "πŸ•›"
case (0, true): return "πŸ•§"
case (1, false): return "πŸ•"
case (1, true): return "πŸ•œ"
case (2, false): return "πŸ•‘"
case (2, true): return "πŸ•"
case (3, false): return "πŸ•’"
case (3, true): return "πŸ•ž"
case (4, false): return "πŸ•“"
case (4, true): return "πŸ•Ÿ"
case (5, false): return "πŸ•”"
case (5, true): return "πŸ• "
case (6, false): return "πŸ••"
case (6, true): return "πŸ•‘"
case (7, false): return "πŸ•–"
case (7, true): return "πŸ•’"
case (8, false): return "πŸ•—"
case (8, true): return "πŸ•£"
case (9, false): return "πŸ•˜"
case (9, true): return "πŸ•€"
case (10, false): return "πŸ•™"
case (10, true): return "πŸ•₯"
case (11, false): return "πŸ•š"
case (11, true): return "πŸ•¦"
default: fatalError("An unexpected error has occurred obtaining the clock emoji.")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment