Skip to content

Instantly share code, notes, and snippets.

@samtstern
Created August 13, 2016 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samtstern/77d5055720f240137c82047166da827f to your computer and use it in GitHub Desktop.
Save samtstern/77d5055720f240137c82047166da827f to your computer and use it in GitHub Desktop.
//
// ViewController.swift
// testProjectforFirebase
//
// Created by Jacob Platin on 8/11/16.
// Copyright © 2016 Jacob Platin. All rights reserved.
//
import UIKit
import Firebase
class ViewController: UIViewController {
@IBOutlet weak var profileChangeLabel: UILabel!
@IBOutlet weak var button: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func myButton(sender: UIButton) {
print("BUTTON PRESS")
FIRAuth.auth()?.signInWithEmail("sam@example.com", password: "sam1234", completion: { (user, error) in
print(error)
user?.profileChangeRequest().photoURL = NSURL(string: "Hometown")
user?.profileChangeRequest().commitChangesWithCompletion({ error in
print("COMPLETION")
if let error = error {
// An error happened.
print("ERROR")
print(error)
} else {
// Profile updated.
print("SUCCESS")
let user = FIRAuth.auth()?.currentUser
print(user)
print(user?.email)
}
})
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment