Код на Swift 1.2:
var error:NSError? = nil
if (fileManager.removeItemAtPath(exportPath as String, error: &error))
{
//Error - handle if requried
}
Не мога да компилирам този код в Swift 2.0, когато използвам блок try and catch.
Swift 2.0 код
do {
check = try fileManager.removeItemAtPath(exportPath as String)
if(//some condition)
{
// whatever
}
}
catch {
check = nil
}