EDIT: похоже на тот же вопрос, что и this 
Я сделал представление коллекции с пользовательским макетом и ячейкой, но мои позиции на ячейке были немного от меня, поэтому я решил их номер, чтобы я мог легче отлаживать его. Я последовал за этим парнем answer, чтобы присвоить номер моей ячейке, используя метки. Каким-то образом myLabel было нулевым и вызвало сбой моего приложения.
Я считаю, что правильно подключил розетки, но, возможно, кто-то может предоставить мне список, чтобы проверить, не делаю ли я что-то неправильно.
ViewController
import UIKit
class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate {
  @IBOutlet var gridView: UICollectionView!
  private let reuseIdentifier = "DesignCell"
  private let numberOfSections = 1
  private let numberOfCircles = 48
  override func viewDidLoad() {
    super.viewDidLoad()
    self.gridView.registerClass(MyCell.self, forCellWithReuseIdentifier: reuseIdentifier)
  }
  func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
    return numberOfSections
  }
  func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
    return numberOfCircles
  }
  func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
    let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! MyCell
    cell.myLabel.text = String(indexPath.item) // myLabel is nil and causes a crash
    return cell
  }
  override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
  }
}
GridLayout (мой пользовательский макет)
import UIKit
import Darwin
class GridLayout: UICollectionViewLayout {
  private let numberOfColumns = 12
  private let numberOfRows = 4
  private var cache = [UICollectionViewLayoutAttributes]()
  private var contentHeight: CGFloat = 0
  private var contentWidth: CGFloat {
    let insets = collectionView!.contentInset
    return CGRectGetWidth(collectionView!.bounds) - insets.left - insets.right
  }
  override func prepareLayout() {
    // some calculation i did for my cells
  }
  override func collectionViewContentSize() -> CGSize {
    return CGSize(width: contentWidth, height: contentHeight)
  }
  override func layoutAttributesForElementsInRect(rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
    var layoutAttributes = [UICollectionViewLayoutAttributes]()
    for attr in cache {
      if CGRectIntersectsRect(attr.frame, rect) {
        layoutAttributes.append(attr)
      }
    }
    return layoutAttributes
  }
}
MyCell
import UIKit
class MyCell : UICollectionViewCell {
  @IBOutlet weak var myLabel: UILabel!
}
