Skip to content

Commit ba854b4

Browse files
ogresRobert Widmann
authored and
Robert Widmann
committed
Use precondition instead of fatalError in DateInterval initializer
1 parent 48dcf5c commit ba854b4

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Darwin/Foundation-swiftoverlay/DateInterval.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ public struct DateInterval : ReferenceConvertible, Comparable, Hashable, Codable
5454
///
5555
/// - precondition: `end >= start`
5656
public init(start: Date, end: Date) {
57-
if end < start {
58-
fatalError("Reverse intervals are not allowed")
59-
}
60-
57+
precondition(end >= start, "Reverse intervals are not allowed")
6158
self.start = start
6259
duration = end.timeIntervalSince(start)
6360
}

0 commit comments

Comments
 (0)