This file contains hidden or 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 String { | |
| func fromNow() -> String { | |
| guard Double(self) != nil else { | |
| return "Invalid Date" | |
| } | |
| let from = NSDate(timeIntervalSince1970: Double(self)!) | |
| let now = NSDate() | |
| let cal = NSCalendar.currentCalendar() |
This file contains hidden or 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 UIColor { | |
| class func hex(string: String) -> UIColor { | |
| var hex = string.hasPrefix("#") | |
| ? String(string.characters.dropFirst()) | |
| : string | |
| guard hex.characters.count == 3 || hex.characters.count == 6 || hex.characters.count == 8 | |
| else { return UIColor.whiteColor().colorWithAlphaComponent(0.0) } | |
| if hex.characters.count == 3 { |