For simple examples of MapsIndoors implementations, run
pod try MapsIndoors (follow the tutorials below for setting up CocoaPods, or just clone this repository) and run the XCode Scheme called Demos. The code for these samples are to find in the /Example/DemoSamples folder.
You can follow the tutorials on this site to start your app from scratch or to enhance the basic examples.
Set up your environment
If you haven’t already, install CocoaPods: Getting Started with CocoaPods
- If you don’t have an Xcode project yet, create one now and save it to your local machine. (If you’re new to iOS development, create a “Single View Application”.)
- Create a file named
Podfilein your project directory. This file defines your project’s dependencies.
- Edit the
Podfileand add your dependencies. Here is an example:
source 'https://github.com/CocoaPods/Specs.git' target 'YOUR_APPLICATION_TARGET_NAME_HERE' do pod 'MapsIndoors', '~>3.5' end
- Save the
- Open a terminal and go to the directory containing the
- Run the
pod installcommand. This will install the APIs specified in the
Podfile, along with any dependencies they may have.
- Close Xcode, and then open (double-click) your project’s .xcworkspace file to launch Xcode. From this time onwards, you must use the .xcworkspace file to open the project.
- Add your credentials to your
- Add the following import statements:
import GoogleMaps import MapsIndoors
- Add the following to your
GMSServices.provideAPIKey( "YOUR_GOOGLE_API_KEY") MapsIndoors.provideAPIKey( "YOUR_MAPSINDOORS_API_KEY", googleAPIKey: "YOUR_GOOGLE_API_KEY")
YOUR_GOOGLE_API_KEYwith your Google API key
YOUR_MAPSINDOORS_API_KEYwith your MapsIndoors API key. (In MapsIndoors iOS SDK v1, this key was known as your
Get your Google Maps API keys
You need to setup the Google Maps API in your project by following the steps in the link below:
- iOS: Google Maps SDK for iOS.
Some Web Service APIs are needed also for the MapsIndoors SDK, so make sure to enable them when getting your key:
Remember to enable relevant Maps products (i.e. SDK for iOS) in your Google project and include these on your API key if you apply restrictions.
Get a Google Maps up and running
MPMapControl class to set up a Google map with MapsPeople venues, buildings & locations. Place the following code in the
viewDidLoad method in your view controller displaying the Google map.
// Place the map above the demo-building let camera = GMSCameraPosition.camera(withLatitude: 57.08585, longitude: 9.95751, zoom: 17) // Initialise the Google map mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera) view = mapView let myMapControl = MPMapControl.init(map: mapView)!
Set the MapsIndoors API Key
In order to include MapsIndoors in your app, you need an API key. If you are not a customer you can use this API key
57e4e4992e74800ef8b69718 to follow the above guide.
In order to include MapsIndoors in your own app with your own content, you need to contact MapsPeople to get your building drawings processed and hosted by us.
You will receive a unique API key to use when access has been granted. If you are exploring how this service can become part of your own product, you can read about partnering with MapsPeople here.