Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate {
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view, typically from a nib.
- }
- func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
- return 100
- }
- func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
- return collectionView.dequeueReusableCell(withReuseIdentifier: "default", for: indexPath)
- }
- }
- class CustomViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate {
- static let cellID = "default";
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view, typically from a nib.
- }
- func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
- return 100
- }
- func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
- return collectionView.dequeueReusableCell(withReuseIdentifier: CustomViewController.cellID, for: indexPath)
- }
- }
Add Comment
Please, Sign In to add comment