1
1
mirror of https://github.com/danbee/persephone synced 2025-03-04 08:39:11 +00:00
persephone/iOS/Components/Browser/Album Browser/AlbumDataSource.swift

35 lines
1.0 KiB
Swift

//
// AlbumDataSource.swift
// Persephone
//
// Created by Daniel Barber on 2019/2/20.
// Copyright © 2019 Dan Barber. All rights reserved.
//
import UIKit
class AlbumDataSource: NSObject, UICollectionViewDataSource {
var albums: [Album] = []
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return albums.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let item = collectionView.dequeueReusableCell(withReuseIdentifier: "AlbumViewCell", for: indexPath)
guard let albumViewCell = item as? AlbumItemCell else { return item }
albumViewCell.setAlbum(albums[indexPath.item])
return albumViewCell
}
//
// override func indexTitles(for collectionView: UICollectionView) -> [String]? {
// return ["#"]
// }
//
// override func collectionView(_ collectionView: UICollectionView, indexPathForIndexTitle title: String, at index: Int) -> IndexPath {
// return IndexPath(index: 0)
// }
}