The code is for a podcasting app.
import AVKit
extension CMTime {
func toDisplayString() -> String {
let totalSeconds = Int(CMTimeGetSeconds(self))
let seconds = totalSeconds % 60
let minutes = totalSeconds / 60
let timeFormatString = String(format: "%02d:%02d", minutes, seconds)
return timeFormatString
}
}
It fails when selecting a podcast to play... resulting in audio playing but the app to freeze until rebooted.
Edit: The error ocurs on line let totalSeconds = Int(CMTimeGetSeconds(self))