Skip to content

Instantly share code, notes, and snippets.

@catqbat
Created May 4, 2017 14:41
Show Gist options
  • Save catqbat/cc67aea231ec36b04018e46f2ef9638d to your computer and use it in GitHub Desktop.
Save catqbat/cc67aea231ec36b04018e46f2ef9638d to your computer and use it in GitHub Desktop.
//Asks your data source object for the number of items in the specified section.
//func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
{
return locations.count;
}
//Asks your data source object for the cell that corresponds to the specified item in the collection view.
//func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
{
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "LocationCell", for: indexPath) as! LocationCell;
let location = locations[indexPath.row];
cell.locationName = location.name;
return cell;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment