A few years after the question was asked, I recommend rewriting it literally and using the API associated with the URL
let fileURL = URL(fileURLWithPath:"/Applications/MySample.app")
if let _ = try? fileURL.checkResourceIsReachable() {
}
source
share