Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//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