Expected Expression Error Swift 3 -
i'm getting silly error can't find out it's coming from. if can on code that'd great, it's super simple i'm looking over! error "expected expression" on last line of code! thank you!
// // viewcontroller.swift // intern // // created lani daniels on 8/1/17. // copyright © 2017 lani daniels. rights reserved. // import uikit import firebase import firebasedatabase import firebaseauth class homeviewcontroller: uiviewcontroller, uitextfielddelegate { @iboutlet weak var emailfield: uitextfield! @iboutlet weak var passwordfield: uitextfield! @iboutlet weak var actionbutton: uibutton! override func viewdidload() { super.viewdidload() //do additional setup after loading view, typically nib. self.passwordfield.delegate = self; } @ibaction func createnew(_ sender: any) { self.performsegue(withidentifier: "createaccount", sender: self) } @ibaction func signintapped(_ sender: any) { self.performsegue(withidentifier: "tomm", sender: self) if emailfield.text != "" && passwordfield.text != "" { auth.auth().signin(withemail: emailfield.text!, password: passwordfield.text!, completion: { (user, error) in if user != nil { // sign in successful } else { if let myerror = error?.localizeddescription { print(myerror) } else { print("error") } }} ) func textfieldshouldreturn(_ textfield: uitextfield) -> bool { self.view.endediting(true) return false )}}}} //error: expected expression
several closing characters misplaced. here code, correctly formatted:
// // viewcontroller.swift // intern // // created lani daniels on 8/1/17. // copyright © 2017 lani daniels. rights reserved. // import uikit import firebase import firebasedatabase import firebaseauth class homeviewcontroller: uiviewcontroller, uitextfielddelegate { @iboutlet weak var emailfield: uitextfield! @iboutlet weak var passwordfield: uitextfield! @iboutlet weak var actionbutton: uibutton! override func viewdidload() { super.viewdidload() //do additional setup after loading view, typically nib. self.passwordfield.delegate = self; } @ibaction func createnew(_ sender: any) { self.performsegue(withidentifier: "createaccount", sender: self) } @ibaction func signintapped(_ sender: any) { self.performsegue(withidentifier: "tomm", sender: self) if emailfield.text != "" && passwordfield.text != "" { auth.auth().signin(withemail: emailfield.text!, password: passwordfield.text!, completion: { (user, error) in if user != nil { // sign in successful } else { if let myerror = error?.localizeddescription { print(myerror) } else { print("error") } } }) } } func textfieldshouldreturn(_ textfield: uitextfield) -> bool { self.view.endediting(true) return false } }
wiki
Comments
Post a Comment