When I call this method, an error received. How to handle NaN or infinite value during assign to hour, min or sec?
Here is my code:
private func se
You should check if totalSeconds is a valid value, like:
totalSeconds
guard !(totalsSeconds.isNaN || totalSeconds.isInfinite) else { return "illegal value" // or do some error handling }
And check this: Convert Float to Int in Swift