Skip to content
This repository was archived by the owner on Feb 12, 2020. It is now read-only.

Commit 9100475

Browse files
committed
Added if statement for range function to work on Swift 3 or 4
1 parent 8ea70c8 commit 9100475

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/DateHelper.swift

+4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ public extension Date {
3131
guard let match = regex.firstMatch(in: string, range: NSRange(location: 0, length: string.utf16.count)) else {
3232
return nil
3333
}
34+
#if swift(>=4.0)
3435
let dateString = (string as NSString).substring(with: match.range(at: 1))
36+
#else
37+
let dateString = (string as NSString).substring(with: match.rangeAt(1))
38+
#endif
3539
let interval = Double(dateString)! / 1000.0
3640
self.init(timeIntervalSince1970: interval)
3741
return

0 commit comments

Comments
 (0)