 
     self.view.endEditing(true)
 
-    //get the appdelegate and store it in a variable
     let appDelegate:AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
-
-    //get the storyboard an store it in a variable
     let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
 
 


        //Popover above the textfield
        popoverController.permittedArrowDirections = .Down

        //Set the delegate
        popoverController.delegate = self

        //Show the popover

  func validateFields(){
    //Check if username is empty
    
    if(userNameTextField.text == nil || userNameTextField.text!.isEmpty){

      //if empty change username textfield border color to red
      userNameTextField.layer.borderColor = UIColor.redColor().CGColor
      userNameTextField.layer.borderWidth = 1.0

      let popoverVC = storyboard?.instantiateViewControllerWithIdentifier("loginPopover")
      popoverVC!.modalPresentationStyle = .Popover
      popoverVC!.preferredContentSize = CGSizeMake(250, 50)


