Skip to content

Instantly share code, notes, and snippets.

@thieso2
Created November 17, 2020 08:47
Show Gist options
  • Select an option

  • Save thieso2/04ed801ba47fdd16049be4b4961cb498 to your computer and use it in GitHub Desktop.

Select an option

Save thieso2/04ed801ba47fdd16049be4b4961cb498 to your computer and use it in GitHub Desktop.
CMTimeFlags.description
import CoreMediaIO
extension CMTimeFlags: CustomStringConvertible {
public var description: String {
let flags : [(CMTimeFlags, String)] = [
(.valid, "valid"),
(.hasBeenRounded, "hasBeenRounded"),
(.positiveInfinity, "positiveInfinity"),
(.negativeInfinity, "negativeInfinity"),
(.indefinite, "indefinite"),
(.impliedValueFlagsMask, "impliedValueFlagsMask")
]
return flags
.compactMap { self.contains($0.0) ? $0.1 : nil }
.joined(separator: ",")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment