Enterprise Data
Using Mappedin SDK for iOS with your own map requires a Pro license. Try a demo map for free or refer to the Pricing page for more information.
The Enterprise Data classes described in this guide are populated in Mappedin CMS, which requires a Solutions Tier subscription.
Enterprise Locations
An EnterpriseLocation contains metadata about a location, such as its name, description, logo, phone number, social medial links, hours of operation and more. They can be accessed using the MapData.getByType() method as shown below.
mapView.mapData.getByType(MapDataType.enterpriseLocation) { [weak self] (result: Result<[EnterpriseLocation], Error>) in
switch result {
case .success(let enterpriseLocations):
print("getByType success: \(enterpriseLocations)")
case .failure(let e):
print("getByType error: \(e)")
}
}
Enterprise Categories
An EnterpriseCategory groups one or more EnterpriseLocation. These allow similar locations to be sorted in a logical fashion. For example a mall may group locations into Food Court, Footwear and Women's Fashion. They can be accessed using the MapData.getByType() method as shown below.
mapView.mapData.getByType(MapDataType.enterpriseCategory) { [weak self] (result: Result<[EnterpriseCategory], Error>) in
switch result {
case .success(let enterpriseCategories):
print("getByType success: \(enterpriseCategories)")
case .failure(let e):
print("getByType error: \(e)")
}
}
EnterpriseCategory can contain one or more sub EnterpriseCategory that are accessed from its children member.
Enterprise Venue
The EnterpriseVenue class holds metadata about the map, which includes the map name, supported languages, default language, top locations and more. It can be accessed using the MapData.getByType() method as shown below.
mapView.mapData.getByType(MapDataType.enterpriseVenue) { [weak self] (result: Result<[EnterpriseVenue], Error>) in
switch result {
case .success(let enterpriseVenue):
print("getByType success: \(enterpriseVenue)")
case .failure(let e):
print("getByType error: \(e)")
}
}
Search
Note that the MapData class instantiates the Search class and exposes it as MapView.mapData.search. Use MapView.mapData.search to utilize Search' methods.
The Search functionality allows users to search for locations, categories, and other points of interest within the venue.
A complete example demonstrating Search can be found in the Mappedin iOS Github repo: SearchDemoViewController.swift
Here are two ways to enable search:
- Enable Search on map initialization:
// See Trial API key Terms and Conditions
// https://developer.mappedin.com/docs/demo-keys-and-maps
let options = GetMapDataWithCredentialsOptions(
key: "5eab30aa91b055001a68e996",
secret: "RJyRXKcryCMy4erZqqCbuB1NbR66QTGNXVE0x3Pg6oCIlUR1",
mapId: "mappedin-demo-mall",
search: SearchOptions(enabled: true)
)
mapView.getMapData(options: options) { [weak self] r in
- Enable Search via method:
mapView.mapData.search.enable { [weak self] result in
guard let self = self else { return }
if case .success = result {
print("Search enabled")
self.loadAllLocations()
}
}
Search Query
Use Search.query to search for locations based on a string input:
- EnterpriseLocationOptions: Specific places such as stores, restaurants, or washrooms.
- EnterpriseCategoryOptions: Groups of locations, such as "Food Court" or "Electronics."
- PlaceOptions: Any main objects that can be searched for such as Space, Door, PointOfInterest
Search query returns a list of matching SearchResult based on the input string.
SearchResult include information about the type of match, the score (relevance), and detailed metadata about the matching items.
Example Search Query
mapView.mapData.search.query(term: suggestion.suggestion) { [weak self] result in
guard let self = self else { return }
if case .success(let searchResult) = result {
print("Search result: \(searchResult)")
}
}
Search Suggestions
Use Search.suggest to fetch real-time suggestions based on partial input. This is useful for creating an autocomplete feature for a search bar.
Example Code
mapView.mapData.search.suggest(term: searchText) { [weak self] result in
guard let self = self else { return }
if case .success(let suggestions) = result {
print("Suggestions: \(suggestions)")
}
}
A complete example demonstrating Search can be found in the Mappedin iOS Github repo: SearchDemoViewController.swift