From the course: Advanced iOS App Development: MapKit & Core Location
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Request location by keyword - iOS Tutorial
From the course: Advanced iOS App Development: MapKit & Core Location
Request location by keyword
- [Instructor] You just saw how to use geocoding to get a coordinate. Using MapKit, you can also find a series of locations based on a natural language phrase. This is best for finding landmarks or for more general searches than an address. Let's search for pizza restaurants near our historical restaurants. Stop the app, and in view controller head back to the find pizza action. Comment out the code that is already there. You'll use a MK local search, and an MK local search request to find your locations. The search request is an MK local search request object. The simple way to use it is to make one and set two properties. I'll initialize a search request like this. Let request equal MK Local search request. The first property is a string with the user's request. Usually, this will be a find control or text box. But for our example, I'll use a literal string for simplicity. Request dot natural language query equals pizza. The request knows we're looking for pizza, but it doesn't know…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.