Skip to content
This repository has been archived by the owner on Mar 29, 2018. It is now read-only.

Commit

Permalink
added strideable methods
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeleisel committed Feb 1, 2015
1 parent 48f084a commit 53f018b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ExSwift/NSDate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,16 @@ public extension NSDate{
}
}

extension NSDate: Strideable {
public func distanceTo(other: NSDate) -> NSTimeInterval {
return other - self
}

public func advancedBy(n: NSTimeInterval) -> Self {
return self.dynamicType(timeIntervalSinceReferenceDate: self.timeIntervalSinceReferenceDate + n)
}
}

// MARK: Comparable functions

public func ==(lhs: NSDate, rhs: NSDate) -> Bool {
Expand Down

0 comments on commit 53f018b

Please sign in to comment.