Skip to content

s3lvin/DXTimestamper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DXTimestamper

Version License Platform

Usage

To run the example project, clone the repo, and run the example project. Please open the workspace not just the project.

Integrating DXTimestamper in your project

Features packed

  1. You can use DXTimestampLabel for showing fuzzy timestamps instead of UILabels
  2. 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.
  3. The default timestamp will be represented by one of the following entries:
    1. now => rightnow
    2. (n) s => n seconds
    3. (n) m => n minutes
    4. (n) h => n hours
    5. (n) d => n days
    6. (n) w => n weeks

configuration

  1. Change the class of the UILabel to DXTimestampLabel and change the class of UIButton to DXTimestampButton in storyboard.
  2. Assign a NSDate object to timestamp property of the DXTimestampLabel or DXTimestampButton
  3. Timestamp will updated for each second. This works for past time as well as future time.

Using Custom fuzzy logic

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.

Screenshot

DXCustomCallout

Requirements

  • iOS 7 or above
  • Requires ARC

Installation

DXTimestamper is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "DXTimestamper"

Author

s3lvin, mariaselvin@gmail.com

Notes

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 :)

License

DXTimestamper is available under the MIT license. See the LICENSE file for more info.

About

A simple yet extensible solution to showing live timestamps on iOS, for past & future NSDates.

Resources

License

Stars

Watchers

Forks

Packages

No packages published