Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Chandlerdea authored Dec 4, 2017
1 parent 31c67cf commit 4194119
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You can just drop DateTransformer.xcodeproj into your project and then add DateT

## Use

There are two `NSValueTransformer` subclasses you can use, `StringToDateTransformer` and `TimeIntervalToStringTransformer`.
There are 3 `NSValueTransformer` subclasses you can use, `StringToDateTransformer`, `TimeIntervalToStringTransformer` and `DateToTimestampTransformer`.

### StringToDateTransformer

Expand Down Expand Up @@ -59,6 +59,18 @@ if let countdownString: String = transformer.transformTimeInterval(secondsToFutu
```

### DateToTimestampTransformer

`DateToTimestampTransformer` transforms a `Date` to a `String` timestamp. You would use this for showing a timestamp like `3 minutes ago`. Here's an example:

```
let dateInPast: Date = ...
let transformer: DateToTimestampTransformer = DateToTimestampTransformer()
if let timestamp: String = transformer.transformDate(dateInPast) {
// "4 minutes ago"
}
```

## Support

If you find any bugs, or have any critiques, please open a PR and I will fix them as soon as I can. And if you feel the need to add some more tests, you're more than welcome!

0 comments on commit 4194119

Please sign in to comment.