Skip to content

Instantly share code, notes, and snippets.

@s3itz
Created November 13, 2014 04:01
Show Gist options
  • Save s3itz/8d4a458e1c7cc63a0cec to your computer and use it in GitHub Desktop.
Save s3itz/8d4a458e1c7cc63a0cec to your computer and use it in GitHub Desktop.
extension NSFileManager {
func fileExists(path: String) -> (Bool, isDirectory: Bool) {
var dir: ObjCBool = true
let status = self.fileExistsAtPath(path, isDirectory: &dir)
return (status, dir.boolValue)
}
}
NSFileManager.defaultManager().fileExists("/Applications").isDirectory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment