I'm making a weather app and I have a view controller that the user goes to enter any location.
I'm using the SOL open source weather app to search the locations with CLGeocoder
I'm mainly focusing on this:
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
{
[self.geocoder geocodeAddressString:searchString completionHandler: ^ (NSArray *placemarks, NSError *error) {
self.searchResults = [[NSMutableArray alloc]initWithCapacity:1];
for(CLPlacemark *placemark in placemarks) {
if(placemark.locality) {
[self.searchResults addObject:placemark];
}
}
[controller.searchResultsTableView reloadData];
}];
return NO;
}
Everything works fine. the only problem is that you have to type in the entire location for it to pop up in the table view. What I'd like is something more like the iOS standard weather app, where you start entering the location and suggestions pop up like this
I've looked at other questions here, and here but they are pretty outdated and dont really help. My question is, can you do it with CLGeocoder? or do you need to use a third party API like here?
Thanks