0
        confirmBtn.addTarget(self, action: #selector(changePassword(email:currentPassword:newPassword:completion:)), for: .touchUpInside)
}



func changePassword(email: String, currentPassword: String, newPassword: String, completion: @escaping (Error?) -> Void) {
        let credential = EmailAuthProvider.credential(withEmail: email, password: currentPassword)
        Auth.auth().currentUser?.reauthenticate(with: credential, completion: { (result, error) in
            if let error = error {
                completion(error)
            }
            else {
                Auth.auth().currentUser?.updatePassword(to: newPassword, completion: { (error) in
                    completion(error)
                })
            }
        })
    }

how Selector send parameter error is Argument of '#selector' refers to instance method 'changePassword(email:currentPassword:newPassword:completion:)' that is not exposed to Objective-C

i don't understand

  • 1
    Have you tried marking the function with @objc attribute so that `@objc func changePassword(email:_, currentPassword:_, newPassword:_, completion:_)`? @objc attribute exposes the function to the Obj-C runtime. – Daniel Arden May 11 '21 at 15:20
  • Side note, you won't have the parameters. You don't send parameters with `addTarget()`. On `touchUpInside`, it will be called. Instead read the value of your `UITextField` (I guess). – Larme May 11 '21 at 15:28
  • 1
    Not enough info, but possible duplicate of https://stackoverflow.com/q/24814646/10853463 – red_menace May 11 '21 at 15:53

0 Answers0