Contents

string(from:)

Returns a formatted string based on the specified number of seconds.

Declaration

func string(from ti: TimeInterval) -> String?

Parameters

  • ti:

    The time interval, measured in seconds. The value must be a finite number. Negative numbers are treated as positive numbers when creating the string.

Return Value

A formatted string representing the specified time interval.

Discussion

This method formats the specified number of seconds into the appropriate units. For example, if the formatter allows the display of minutes and seconds, creating an abbreviated string for the value 70 seconds results in the string “1m 10s”.

See Also

Formatting Values