Mappedin Logo


Mappedin Documentation

iOS SDK: Quickstart

iOS SDK: Quickstart

This quickstart guide is written for a new Storyboard application that has been initialized with Cocoapods.

Add dependency to CocoaPods

For more information on how to use Cocoapods, see here.

Mappedin's SDK is available through CocoaPods. You can find the latest version on Github. To install it, add the dependency to your Podfile in your project's root directory:

pod 'MappedIn', '3.0.2'

In the terminal, run pod install in your project's root directory.

To import the module into the project, add the following line to your ViewController:

import Mappedin

Note: In order for your project to recognize the Pods framework, you must be working from the .xcworkplace file rather than the individual .xcproj file

Refer to our Github repository to view the sample app created by Mappedin developers to understand how to embed a map into your app.

Display the Venue

Create an MPIMapView instance and Add MPIMapView to View

Next you will need to initialize an MPIMapView instance mapView in the viewDidLoad() method of your ViewController and add it to the layout:

override func viewDidLoad() {
let screenRect = UIScreen.main.bounds
let screenWidth = screenRect.size.width
let screenHeight = screenRect.size.height
// Set up MPIMapView and add to view
mapView = MPIMapView(frame: CGRect(x: 0, y: 0, width: screenWidth, height: screenHeight))
Load the Venue

loadVenue is a MPIMapView function that allows you to render the venue in your app by passing in an options object and an optional showVenueOptions object.

The options object contains your venue, clientId, clientSecret, optional headers etc. To get you started we’ve provided a Mappedin Id and Secret that has access to some demo venues. When you’re ready to start using your own venues with the SDK you will need to contact a Mappedin representative to get your own unique Id and Secret.

clientIdSee Here
clientSecretSee Here

You can also pass in showVenueOptions to modify the properties of the map, including backgroundColor, firstMapId, labelAllLocationsOnInit (whether labels appear), backgroundAlpha, on the first load. The following sample code shows an example of how to use it:

// use loadVenue to load venue
options: MPIOptions.Init(clientId: "5eab30aa91b055001a68e996", clientSecret: "RJyRXKcryCMy4erZqqCbuB1NbR66QTGNXVE0x3Pg6oCIlUR1",
venue: "mappedin-demo-mall",
headers: [MPIHeader(name: "testName", value: "testValue")]),
showVenueOptions: MPIOptions.ShowVenue(labelAllLocationsOnInit: true, backgroundColor: "#CDCDCD")

showVenue is an alternative method to load the venue without using any API calls to retrieve the data. Instead, the data must be passed into the showVenue method which takes in a data string (which can be retrieved from a file).

Use this sample JSON file to get started with the showVenue method.

Here is an example:

// use showVenue to load venue
if let path = Bundle.main.path(forResource: "mappedin-demo-mall", ofType: "json") {
venueDataString = try? String(contentsOfFile: path)
if let venueDataString = venueDataString {
venueResponse: venueDataString,
showVenueOptions: MPIOptions.ShowVenue(labelAllLocationsOnInit: true, backgroundColor: "#CDCDCD")

You should see something that looks like this:

Search Our Docs

Sign Up

© 2020 Copyright Mappedin, All Rights Reserved. View our Privacy Policy