Skip to content

Instantly share code, notes, and snippets.

@mitnick78
Created June 4, 2018 16:03
Show Gist options
  • Save mitnick78/87aeac4bf8abc067b284071ce6522572 to your computer and use it in GitHub Desktop.
Save mitnick78/87aeac4bf8abc067b284071ce6522572 to your computer and use it in GitHub Desktop.
//
// MonumentCollection.swift
// wherein
//
// Created by christophe milliere on 20/05/2018.
// Copyright © 2018 christophe milliere. All rights reserved.
//
import UIKit
extension MapViewController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout{
func setupCollectionView() {
collectionView.delegate = self
collectionView.dataSource = self
collectionView.reloadData()
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 5
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let monument = monuments[indexPath.item]
print("Cell \(monument)")
if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellId, for: indexPath) as? MonumentCollectionCell {
cell.setup(monument: monument)
return cell
}
return UICollectionViewCell()
}
// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
// return CGSize(width: 150, height: 150)
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment