Removed different api for dealing with optionals
If you pass an optional value to mightFail, the first guard is for the error check, you'll need a second guard to see if you have a value.
func returnOptional() throws -> String? {
return nil
}
let (error, result) = mightFail {
try returnOptional()
}
// result is String??
guard let result else {
// there was an error, handle it
print(error)
return
}
guard let result else {
// no error, but result is nil, handle it
print("No result")
return
}
print(result) // "Success"