Q:

"Computed property must have an explicit type" error: how to list files in Swift 2.x?

The following code generates a Computed property must have an explicit type error.
What's the right way to list files with the new try/catch Swift syntax?
do {
       let files = try NSFileManager.defaultManager().contentsOfDirectoryAtPath(docsPath as String) as! [String] {
       print("Found \(files.count) file(s) in \(docsPath):")
}catch{
       print("Error with listing files: \(error)")
}

A:

You've added an extra curly bracket { after your try statement (after ... as! [String]) that is not needed. This extra curly bracket makes Swift believe that you're working with a computed property. 
Remove the bracket and your do-try-catch block should work :
var docsPath : String = "notavalidpath"
do {
    let files = try NSFileManager.defaultManager().contentsOfDirectoryAtPath(docsPath as String) as! [String]
    print("Found \(files.count) file(s) in \(docsPath):")
}catch{
    print("Error with listing files: \(error)")
}

