title: segue to next ViewController and pass data if condition is valid
body: <p>I am trying to segue from first viewcontroller to the second one and pass the value of <code>var dateAndTime = NSDate()</code> to the second view controller.</p>
  
  <p>My first approach was to segue from the first viewcontroller itself to the second one, define the name of the segue in Attributes inspector. 
  Next, I link a button <code>@IBAction func nextButtonToFifthViewController</code> in the first viewcontroller, use an <code>if else</code> statement and <code>prepareForSegue</code>, but the code does not compile because I am not allowed to override <code>prepareForSegue</code>.</p>
  
  <pre><code>@IBAction func nextButtonToFifthViewController(sender: AnyObject) {
      if timeRestricted.contains(hourComponents){
          self.label.text = "Please choose a time betwen 7:00 - 19:00"
      } else {
  
      override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
          var destViewController:FifthViewController = segue.destinationViewController as! FifthViewController
          destViewController.dateAndTimeSelected = dateAndTime    }
         }
  </code></pre>
  
  <p>My second approach was to use <code>performSegueWithIdentifier</code>, but I wont be able to pass data to the next view controller because <code>dateAndTimeSelected</code> is not available for use in first view controller. </p>
  
  <pre><code>@IBAction func nextButtonToFifthViewController(sender: AnyObject) {
      if timeRestricted.contains(hourComponents){
          self.label.text = "Please choose a time betwen 7:00 - 19:00"
      } else {
  
          performSegueWithIdentifier("toFifthViewController", sender: self)
    dateAndTimeSelected = dateAndTime
  }
  </code></pre>