You can define a custom extension with a computed value for reading isValid :
extension CMTime { var isValid : Bool { return (flags & .Valid) != nil } }
which is then used as
let cm:CMTime = ... if cm.isValid { ... }
Update:. When using Swift 2 / Xcode 7, CMTIME_IS_VALID imported into Swift as
func CMTIME_IS_VALID(time: CMTime) -> Bool
therefore, custom extension is no longer required. If you want to define the isValid property, then the syntax in Swift 2 will be
extension CMTime { var isValid : Bool { return flags.contains(.Valid) } }
source share