Location Services UI Functionality
Many functions associated with Store Location iOS UI are implemented with the standard Apple MapKit
API. For example, the store search results contain latitude and longitude which are passed to the MapKit
API to display the store locations on a map. The search results themselves are obtained from creating an EMAction
using either latitude, longitude and radius or the city/state and fetching content using that action.
Assuming the shopper’s location is known, the MapKit
’s default functionality helps create a radius circle using the MapKit
overlay functionality, as shown in the following sections.
Results List Components
The following components are used to render the results list:
ATGLocationResultsList
| Extends ATGResultsList content item and contains: total number of results list of stores (ATGStoreRecords ) number of results to be displayed first and last result number (depends on number to be displayed) |
ATGLocationResultsListAdaptor
| Extends ATGContentItemAdaptor and controls which renderers will be used (either ATGLocationResultsListRenderer or ATGLocationResultsListMapRenderer ). Sets the object to be rendered (either one ATGStoreRecord or a list of ATGStoreRecords ). Renders the segmented control and the number of results found in the header. |
ATGLocationResultsListRenderer
| Extends EMContentItemRenderer . It implements the setObject method so a content item (in this case an individual ATGStoreRecord ) can be rendered as a UICollectionViewCell containing the store’s information. |
ATGStoreLocatorViewController
| Extends ATGAssemblerViewController and displays the Renderer’s views. Additionally provides methods to change what is displayed on the map and handle showing or hiding refinements and browse. |
Results Map Components
The following components are used for the UI rendering of the results map:
ATGLocationAnnotationView
| Extends MKAnnotationView so it can be initialized with an ATGStoreRecord . Annotation views are reusable components that supply the view of the ATGStoreRecord annotation. In this case it uses the ATGStoreRecord to get the number to display on the image and where to display it on the map. |
ATGLocationResultsListMapRenderer
| Extends EMContentItemRenderer and holds the MKMapView component for the map. It implements the setObject method so a content item (in this case store results) can be rendered on the map. Most of the real processing happens in the ATGStoreLocatorViewController . |
Categories
This functionality is used to render ATGStoreRecord
objects as annotations directly to the map.
ATGStoreRecord+MKAnnotation
| Implements coordinate title and subTitle on MKAnnotation to adapt the ATGStoreRecord information to an MKAnnotation. |
Store Details Components
On the store details page, each store in the results list has an associated detailsAction
(class EMRecordAction
) which is used to fetch store detail content. The following components are used to render the Store Details page:
ATGStoreDetail
| Extends EMContentItem and contains the store record and the store image path. |
ATGStoreDetailAdaptor
| Extends ATGContentItemAdaptor and specifies that the ATGStoreDetailRenderer will be used to render the ATGStoreDetail ’s store. Sets additional data on the ATGStoreDetail ’s store (storeImagePath and the distance to the store) that are not set by default from the Guided Search content item. |
ATGStoreDetailRenderer
| Extends EMContentItemRenderer and implements the setObject method so a contentItem , (in this case the ATGStoreRecord with the additional storeImagePath and distance to the store data) can be rendered as a UIView . |
ATGStoreDetailViewController
| Overrides ATGAssemblerViewController . |