It sounds like you want a DateComponentsFormatter
. That lets you generate strings that describe amounts of time rather than dates.
You could use the function func string(from ti: TimeInterval) -> String?
which takes a time interval and converts it to a string describing an amount of time.
The following code, loosely based on the example code in Apple's documentation on DateComponentsFormatter:
let formatter = DateComponentsFormatter()
formatter.unitsStyle = .full
formatter.includesApproximationPhrase = true
formatter.includesTimeRemainingPhrase = true
formatter.allowedUnits = [.day, .hour, .minute, .second]
print(formatter.string(from: 123456.7) ?? "nil")
Generates the string About 1 day, 10 hours, 17 minutes, 36 seconds remaining
(At least with a US English locale.)