// // ViewController.swift // // Created by Bill Richards on 10/7/14. // Copyright (c) 2014 Bill Richards. All rights reserved. // import UIKit class ViewController: UIViewController { //variable to hold reference to the datasource var dataSource:CollectionViewDataSource? override func viewDidLoad() { super.viewDidLoad() //Init our datasource and setup the closure to handle our cell //modify 'AnyObject' to match your model self.dataSource = CollectionViewDataSource(items: self.items, cellIdentifier: "Cell", configureBlock: { (cell, item) -> () in if let actualCell = cell as? CustomUICollectionViewCell { if let actualItem = item as? AnyObject { actualCell.configureForItem(actualItem) } } }) //finally, set the collectionview datasource self.collectionView.dataSource = self.dataSource } }