Protocols
The following protocols are available globally.
-
The
TimeIntervalLiterals
protocol is used to extendIntegerLiteralType
andFloatLiteralType
to allow for human-readable time notations such as:let sixtySeconds = 60.seconds let twoAndAHalfMinutes = 2.5.minutes let oneWeek = 7.days let anotherWeek = 1.week
Default implementations of the
See moreminutes
,hours
,days
, andweeks
properties are supplied; implementors of theTimeIntervalLiterals
protocol only need to supply an implementation forseconds
.Declaration
Swift
public protocol TimeIntervalLiterals