I've got this simple code to control Collection view, but it doesn't show any cells. The app works, but it's blank. The identifier match with cell identifier and the class is attached to the collection view. I think the problem is with upcast: as! UICollectionViewCell
class CollectionViewController: UICollectionViewController {
var Array = ["one", "two"]
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return Array.count
}
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as! UICollectionViewCell
return cell
}
}