extension URL {
var containsAudio: Bool {
let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension,
self.pathExtension as CFString,
nil)
if UTTypeConformsTo((uti?.takeRetainedValue())!, kUTTypeAudio) {
return true
}
return false
}
var containsVideo: Bool {
let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension,
self.pathExtension as CFString,
nil)
if UTTypeConformsTo((uti?.takeRetainedValue())!, kUTTypeVideo) {
return true
}
return false
}
var containsImage: Bool {
let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension,
self.pathExtension as CFString,
nil)
if UTTypeConformsTo((uti?.takeRetainedValue())!, kUTTypeImage) {
return true
}
return false
}
}
Leave a Reply