This is a direct port of: http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#method-i-distance_of_time_in_words
To override the default strings you can update them before you access them:
let railsStrings = [
"LessThan": "less than ",
"About": "about ",
"Over": "over ",
"Almost": "almost ",
"Seconds": " seconds",
"Minute": " minute",
"Minutes": " minutes",
"Hour": " hour",
"Hours": " hours",
"Day": " day",
"Days": " days",
"Months": " months",
"Years": " years",
]
TimeAgoInWordsStrings.updateStrings(railsStrings)
NSDate(timeIntervalSinceNow: -90).timeAgoInWords() // 2 minutes
TimeAgoInWords is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "TimeAgoInWords"
TimeAgoInWords is available under the MIT license. See the LICENSE file for more info.