"res" 代表什么?

What does "res" stand for?

我注意到 swift,我们经常使用以下代码的一些变体:

func signInWithEmail(email: String, password: String){
    Auth.auth().signIn(withEmail: email, password: password){ (res, err) in
        ...

    }

"res" 代表什么?

谢谢

在这种情况下 "res" 表示 authResults,如用户 uid、电子邮件等

"res"代表"Response"。

与使用的库有关。一般情况下,你贴出的代码原来是这样写的:

 signIn(withEmail: String, password: String, completion: @nonescaping (Response, Error) -> Void) {

  ...

  if !error {

    completion(res, nil) 

  } else {

    completion(nil, err)

  }

}