[Feature] Locations list #10

Merged
javier merged 13 commits from feature/locations-list into main 2023-04-12 16:58:28 +00:00
Showing only changes of commit ea9fea98b3 - Show all commits

View File

@ -48,6 +48,7 @@ extension LocationsListViewModel: LocationsListViewModeling {
// MARK: Properties
var viewStatusPublisher: Published<LocationsListViewStatus>.Publisher { $viewStatus }
var numberOfSectionsInData: Int { fetchedResultsController.sections?.count ?? 0 }
// MARK: Functions
@ -71,6 +72,21 @@ extension LocationsListViewModel: LocationsListViewModeling {
}
}
func numberOfDataItems(in section: Int) -> Int {
guard
let sections = fetchedResultsController.sections,
sections.endIndex > section
else {
return 0
}
return sections[section].numberOfObjects
}
func dataItem(at indexPath: IndexPath) -> Location {
fetchedResultsController.object(at: indexPath)
}
}
// MARK: - Enumerations