我想使用连续的try语句.如果有人返回错误,我想继续下一个,否则返回值.下面的代码似乎工作正常,但我最终会得到一个大的嵌套do catch金字塔.在Swift 3.0中有更聪明/更好的方法吗?
do {
return try firstThing()
} catch {
do {
return try secondThing()
} catch {
return try thirdThing()
}
}
Run Code Online (Sandbox Code Playgroud)