title: Unable to access a value of a property
body: <p>In my project there is a subclass of <code>UICollectionViewCell</code>. The custom cell's got a property of a label. While initializing a <code>UICollectionView</code> instance I also register the custom cell class with its identifier. The problem is being that the property is optional, so in theory it can be nil. I set up the property when configuring cells and it should not be nil. Even though it's assigned with an existing instance of <code>UILabel</code> I've got a runtime error - <strong>Founded nil while unwrapping an optional value</strong>. </p>
  
  <p>The code I used for my cell: </p>
  
  <pre><code>class MonthCalendarCell: UICollectionViewCell {
      var dateLabel: UILabel?
  
      func addDateLabel(label: UILabel) {
          self.dateLabel = label
          self.addSubview(label)
      }
  }
  </code></pre>
  
  <p>This is the initialization of a collection view:</p>
  
  <pre><code>override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
      let calendarFlowLayout = CalendarFlowLayout()
  
      super.init(frame: frame, collectionViewLayout: calendarFlowLayout)
  
      self.dataSource = self
      self.delegate = self
      self.registerClass(MonthCalendarCell.self, forCellWithReuseIdentifier: self.identifier)
  
      // TODO: work on this
      self.backgroundColor = UIColor.groupTableViewBackgroundColor()
  }
  </code></pre>
  
  <p>Configuring a cell: </p>
  
  <pre><code>func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; UICollectionViewCell {
      let cell = collectionView.dequeueReusableCellWithReuseIdentifier(self.identifier, forIndexPath: indexPath) as MonthCalendarCell
  
      let label = UILabel()
      label.text = "1"
      label.frame = CGRectMake(0, 0, cell.bounds.width, cell.bounds.height)
      label.textAlignment = NSTextAlignment.Center
      label.backgroundColor = UIColor.redColor()
  
      self.highlightView(label)
  
      cell.addDateLabel(label)
  
      return cell
  }
  </code></pre>
  
  <p>The problem occurs here: </p>
  
  <pre><code>func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
      let cell = collectionView.dequeueReusableCellWithReuseIdentifier(self.identifier, forIndexPath: indexPath) as MonthCalendarCell
      println(cell.dateLabel!)
  }
  </code></pre>
  
  <p>I've also tried to use get/set way of accessing and initializing, but it doesn't work well. </p>
  
  <pre><code>class MonthCalendarCell: UICollectionViewCell {
      var dateLabel: UILabel? {
          get {
              return self.dateLabel
          }
  
          set(label) {
              self.addSubview(label!)
          }
      }
  }
  </code></pre>
  
  <p>I'd be thankful if you could explain how to set a value and how to return in that case!</p>
  
  <p>And please help me figure out what's wrong with unwrapping the value, who is it nil? </p>
  
  <p>Thank you for any help in advance! </p>