Defined the "openWikipedia(at: )" function in the LocationsListViewModeling protocol and implement it in the LocationsListViewModel view model.

This commit is contained in:
Javier Cicchelli 2023-04-13 00:47:56 +02:00
parent 8dd4de175b
commit ac39e943db
2 changed files with 7 additions and 0 deletions

View File

@ -26,5 +26,6 @@ protocol LocationsListViewModeling: AnyObject {
func location(at indexPath: IndexPath) -> Location
func numberOfLocations(in section: Int) -> Int
func openLocationsAdd()
func openWikipedia(at indexPath: IndexPath)
}

View File

@ -76,6 +76,12 @@ extension LocationsListViewModel: LocationsListViewModeling {
coordinator?.openLocationsAddScreen()
}
func openWikipedia(at indexPath: IndexPath) {
guard let url = locationProvider.location(at: indexPath).wikipediaPlacesURL else {
return
}
coordinator?.openWikipediaApp(with: url)
}
}