To run the example project, clone the repo, and run the example project. Please open the workspace not just the project.
- You can use
DXTimestampLabel
for showing fuzzy timestamps instead of UILabels - You can also use
DXTimestampButton
for showing fuzzy timestamps instead of UIButtons. This gives you flexibility to add custom image as shown in the screenshot, or to implement button events. - The default timestamp will be represented by one of the following entries:
- now => rightnow
- (n) s => n seconds
- (n) m => n minutes
- (n) h => n hours
- (n) d => n days
- (n) w => n weeks
- Change the class of the
UILabel
toDXTimestampLabel
and change the class ofUIButton
toDXTimestampButton
in storyboard. - Assign a
NSDate
object totimestamp
property of theDXTimestampLabel
orDXTimestampButton
- Timestamp will updated for each second. This works for past time as well as future time.
You can set your own fuzzy timestamp calculation logic like this
[DXTimestamper setFuzzyTimestampCalculator:^NSString *(NSDate *timestamp) {
// do fuzzy timestamp calculations and return the fuzzy time string
return @"";
}];
The above configuration is global as of now. You need to call it before using any instance that conform to <DXTimestamping>
. If you want to have this logic to be configurable for each individual instance of <DXTimestamping>
objects then just raise an issue. I will try to work on that.
- iOS 7 or above
- Requires ARC
DXTimestamper is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "DXTimestamper"
s3lvin, mariaselvin@gmail.com
If you want more UIKit
components to be supported by DXTimestamping
either raise an issue. Pull requests are also welcome! Thanks for using DXTimestamper
. Happy coding :)
DXTimestamper is available under the MIT license. See the LICENSE file for more info.