Created
January 2, 2025 06:18
-
-
Save jubishop/2990f064a1f624b660ddcbf034921d72 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private var duration: CMTime? { | |
guard let timeComponents = rssEpisode.iTunes.duration?.split(separator: ":").reversed(), | |
timeComponents.count <= 3 | |
else { return CMTime.zero } | |
var seconds = 0 | |
for (position, value) in timeComponents.enumerated() { | |
guard let value = Int(value) else { return CMTime.zero } | |
var multiplier = 1 | |
for _ in 0..<position { multiplier *= 60 } | |
seconds += multiplier * value | |
} | |
return CMTime.inSeconds(Double(seconds)) | |
} |
Author
jubishop
commented
Jan 2, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment