Created
August 13, 2016 00:04
-
-
Save samtstern/77d5055720f240137c82047166da827f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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