Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let currentUser = PFUser.currentUser()?.username
- if currentUser == nil {
- user.signUpInBackgroundWithBlock() {(success, error) -> Void in
- if success {
- print("successfully saved")
- } else {
- do
- {
- try PFUser.logInWithUsername(username, password: emailData)
- }
- catch
- {
- print(error)
- }
- self.updateUI()
- }
- }
- }
- }
- func updateUI () {
- if let userFirstName = PFUser.currentUser()?["firstName"] as? String {
- firstNameLabel.text = userFirstName
- } else {
- self.firstNameLabel.text = ""
- }
- if let userLastName = PFUser.currentUser()?["lastName"] as? String {
- lastNameLabel.text = userLastName
- } else {
- self.lastNameLabel.text = ""
- }
- if let userPicture = PFUser.currentUser()?["picture"] as? String,
- url = NSURL(string: userPicture),
- data = NSData(contentsOfURL: url),
- image = UIImage(data: data)
- {
- profilePictureImageView?.image = image
- }
- else {
- self.profilePictureImageView.image = nil
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement