7 thoughts on “Simple UICollectionView Using Swift

  1. codemonkey21 says:

    So this is beyond frustrating… Spent the last two hours trying to make this work. When I download your code and run it, it works fine. Mine throws an unwrap Optional.None error on cell.imageView.image = UIImage(named: images[indexPath.row]) The only thing I did differently was add a navigation controller, drag the cell to the width of the phone, and add an additional label. I also tried setting the image without accessing the array and just tossing out the name of the image.

    Any thoughts of why it might be doing this?

  2. Christian Ritchie says:

    I noted in your example that you don’t register the cell class. Is that not required in Swift collection view code?

    self.collectionView.registerClass(HomeCollectionViewCell.self,forCellWithReuseIdentifier:”Cell Identifier”)

    1. Luke Durrant says:

      I know its late but thought I’d help out.
      Looks like you’ve hidden the reuseable cell bit
      However over your mouse “Collection Reuseable View” and then click and you should see it

Leave a Reply

Your email address will not be published. Required fields are marked *