title: UILabel - unexpectedly found nil while unwrapping an Optional value
body: <p>Creating a page dynamically using this code, which creates a PageViewController</p>
  
  <pre><code>import UIKit
  
  class PageViewController: UIViewController, UIPageViewControllerDataSource, UIPageViewControllerDelegate {
  
  var pvc:UIPageViewController?
  var testArray: [String] = []
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      // Do any additional setup after loading the view.
      pvc = UIPageViewController(
              transitionStyle: .Scroll,
              navigationOrientation: .Horizontal,
              options: nil )
  
      // Make this object the datasource and delegate for the PageViewController
      self.pvc?.delegate = self
      self.pvc?.dataSource = self
  
      // Populate an array of test content for the pages
      testArray = ["Page 1", "Page 2", "Page 3"]
  
      // Create an array of child pages
      var swipePage:SwipePageController = SwipePageController()
      println("Page view Controller: \(testArray[0])")
      swipePage.name = testArray[0]
      var pageArray: NSArray = [swipePage]
  
      self.pvc?.setViewControllers(pageArray, direction: .Forward, animated: true, completion: nil)
  
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  func pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) -&gt; UIViewController? {
      let index:Int! = (viewController as SwipePageController).index!
  
      if (index &gt;= self.testArray.count){
          return nil
      }
  
      index + 1
  
      return viewControllerAtIndex(index)
  
  }
  
  func pageViewController(pageViewController: UIPageViewController, viewControllerBeforeViewController viewController: UIViewController) -&gt; UIViewController? {
      let index:Int! = (viewController as SwipePageController).index!
  
      if index == NSNotFound {
          return nil
      }
  
      index - 1
  
      return viewControllerAtIndex(index)
  
  }
  
  func presentationCountForPageViewController(pageViewController: UIPageViewController) -&gt; Int {
      return self.testArray.count
  }
  
  func presentationIndexForPageViewController(pageViewController: UIPageViewController) -&gt; Int {
      let page = self.pvc?.viewControllers[0] as SwipePageController
      let name = page.name
      return find(self.testArray, name!)!
  }
  
  func viewControllerAtIndex(index: Int) -&gt; SwipePageController?
  {
      if self.testArray.count == 0 || index &gt;= self.testArray.count
      {
          return nil
      }
  
      // Create a new view controller and pass suitable data.
      let swipeView = SwipePageController()
      swipeView.name = self.testArray[index]
      swipeView.index = index
  
      return swipeView
  }
  </code></pre>
  
  <p>The println() about a 1/3 of the way down the code, does display the value I expect to see. The code for the ViewController I create dynamically is here:</p>
  
  <pre><code>import UIKit
  
  class SwipePageController: UIViewController {
  
  // var to hold the var to display to the interface
  var name:String?
  var index:Int?
  @IBOutlet weak var testLabel: UILabel!
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      // Do any additional setup after loading the view.
      println(name!)
      if let passedName = name? {
          self.testLabel.text = passedName
      }
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  
  /*
  // MARK: - Navigation
  
  // In a storyboard-based application, you will often want to do a little preparation before navigation
  override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
      // Get the new view controller using segue.destinationViewController.
      // Pass the selected object to the new view controller.
  }
  */
  </code></pre>
  
  <p>}</p>
  
  <p>println(name!) does show the correct value as well. However, I cannot populate the label with the value. I get the following error:</p>
  
  <p>"fatal error: unexpectedly found nil while unwrapping an Optional value"</p>
  
  <p>I'm at my wit's end...I cannot figure out what's not working. Also, see the screen shot of my Xcode interface where the error occurs:</p>
  
  <p><img src="https://i.stack.imgur.com/7QPon.png" alt="screen cap of Xcode interface"></p>
  
  <p>Can anyone help?</p>