Created
August 23, 2015 05:59
-
-
Save JadenGeller/0986833e6fff17cb6e3a to your computer and use it in GitHub Desktop.
Emoji Clock from NSDate π
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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