Hello, Can you help me please ? I am creating a small application that displays the bus timetables of my city. I use UICollectionView to display all the timetables: from 06:00 in the morning to 00:30 in the evening. Buses pass every 30 min. Now I want my cells to scroll automatically according to the time of day, even if the application is closed. I want my cell that displays the next bus (e.g. 2:30 pm) to display at 2:00 pm and automatically scroll after 2:30 pm to display the next bus that comes at 3:00 pm etc. until 00:30 am. And after 00:30, I want to display the cell that shows 06:00). And the process continues ad infinitum. thank you
There my code :
`extension HomeViewController : UICollectionViewDelegate, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return busHoursList.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let busCell = collectionView.dequeueReusableCell(withReuseIdentifier: "busCellID", for: indexPath) as! BusCollectionViewCell
busCell.layer.borderWidth = 0.6
busCell.layer.cornerRadius = 15
busCell.layer.borderColor = CGColor.init(red: 170/250, green: 170/250, blue: 170/250, alpha: 1)
busCell.setupDepartureHours(withText: busDepartureHoursList[indexPath.row])}