         alert.addAction(ok)
         presentViewController(alert, animated: true, completion: nil)
     }
-    
-    
-    
-    @IBAction func fbButtonTapped(sender: UIButton) {
-        let login = FBSDKLoginManager()
-        login.logInWithReadPermissions(["public_profile", "email"], fromViewController: self, handler: { (result,error) -> Void in
-            if error != nil{
-                print(error.localizedDescription)
-                return
-            }else if result.isCancelled{
-                return
-            }else{
-                self.login()
-                print(FBSDKAccessToken.currentAccessToken())
-            }
-        })
-    }
-    
+
+}
+
+// MARK: - Facebook Login
+extension LoginViewController{
     func login(){
         let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
         let homeViewController = self.storyboard?.instantiateViewControllerWithIdentifier("RevealViewController") as! SWRevealViewController

import FBSDKLoginKit
import FBSDKShareKit

class LoginViewController: UIViewController, UITextFieldDelegate {
    
    @IBOutlet weak var loginButton: UIButton!
    @IBOutlet weak var heightTextField: UITextField!
    @IBOutlet weak var weightTextField: UITextField!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        setupBackground()
        setupTextField()
        loginButton.layer.cornerRadius = 30
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        
    }
    
    func setupBackground(){
        let gradientLayer = CAGradientLayer()
        gradientLayer.colors = [UIColor.mrLightblueColor().CGColor, UIColor.mrPineGreen50Color().CGColor]

        }
        
    }
}

// MARK: - Action
extension LoginViewController{
    @IBAction func fbButtonTapped(sender: UIButton) {
        let login = FBSDKLoginManager()
        login.logInWithReadPermissions(["public_profile", "email"], fromViewController: self, handler: { (result,error) -> Void in
            if error != nil{
                print(error.localizedDescription)
                return
            }else if result.isCancelled{
                return
            }else{
                self.login()
                print(FBSDKAccessToken.currentAccessToken())
            }
        })
    }
}

