Created
June 4, 2018 16:03
-
-
Save mitnick78/87aeac4bf8abc067b284071ce6522572 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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