Created
May 18, 2020 17:26
-
-
Save wdchris/04fae466c85f445818c52bccd0c27688 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
class CalendarCell: UICollectionViewCell { | |
@IBOutlet weak var dateLabel: UILabel! | |
static let identifier = "calendarCell" | |
static func register(with collectionView: UICollectionView) { | |
collectionView.register(UINib.init(nibName: "CalendarCell", bundle: nil), forCellWithReuseIdentifier: identifier) | |
} | |
static func dequeue(from collectionView: UICollectionView, at indexPath: IndexPath, forDay day: Int) -> CalendarCell { | |
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath) as? CalendarCell ?? CalendarCell() | |
cell.dateLabel.text = String(format: "%02d", day) | |
return cell | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment