title: Functions completion handler Swift 4
body: <p>How i can return error and completion result and call my function like that?
  What should i write in my function, to return completion result and error if there are any?</p>
  
  <p>example:</p>
  
  <pre><code>signIn(withEmail: emailTextField.text!, password: passwordTextField.text!) { (user, error)  in
      if error == nil {
          self.performSegue(withIdentifier: "loginToHome", sender: nil)
      } else {
          let alertController = UIAlertController(title: "Error", message: error?.localizedDescription, preferredStyle: .alert)
      }
  }
  </code></pre>
  
  <p>my function to edit:  </p>
  
  <pre><code>static func signIn(email: String, enablefor: String, 
                     func: String, completion: @escaping ((User) -&gt; Void))
  </code></pre>