It is possible to use MapsIndoors with multiple map providers, from this point we will call them platforms, like Mapbox Maps and Google Maps, in the same app. The basics of this approach is to create a generic interface for accessing the maps, as well as provide some utility in setting up MapsIndoors.
In this article we will: Install multiple platforms, create a Map interface, create a Fragment interface to hold the MapViews, create implementations of the Map interface for each platform, and then blend them together in a single app.
We will use Google Maps and Mapbox Maps as examples.
Add MapsIndoors
First we have to add both platforms to our build file, it is important that both versions of MapsIndoors use the same version, otherwise we might experience issue with the interface.
Add the MapsIndoors Swift Packages for both mapsindoors-mapbox and mapsindoors-googlemaps to your project using the tools in Xcode (as explained in Installing the MapsIndoors SDK).
Map Interface
The map interface should be as lean as possible, only containing the methods you need to use on the maps, in this example we have added 3 methods for moving the camera, as well the ability to read the current position, projection as well as turning the compass on/off.
This interface can be extended or shrunk to your hearts content, but remember that each method added will have to be implemented on both platforms.