The AerisWeather SDK for iOS fully supports the Mapbox GL SDK for use with your weather maps if your application uses Mapbox for its mapping library instead of Apple's MapKit.
The AerisWeather SDK abstracts away much of the interactions with the Mapbox SDK and other mapping libraries, so it's easy to change the library type just by using the appropriate AWFWeatherMapType
value when initializing your weather map instance. While much of the functionality is the same or very similar across all mapping libraries, there may be some differences due to limitations with a particular mapping library.
In order to use the Mapbox SDK with your weather maps, you will need to follow a similar process to that when initially installing the AerisWeather SDK into your project using one of the following methods:
Add the AerisWeather/Mapbox
pod to your Podfile
alongside the other . This will add the base AerisMapboxMapKit.framework and its core dependencies to your project, including the latest Mapbox SDK for iOS.
pod 'AerisWeather/Mapbox'
Run pod install
from the Terminal at the root of your project where your Podfile
is located.
The Mapbox component of the Aeris Weather SDK for iOS is distributed with the main Carthage package. Just follow the main installation instructions for Carthage to add Mapbox support for your Aeris usage.
Once you've integrated the AerisWeather SDK using the Carthage setup instructions linked above, make sure you've added AerisMapboxMapKit.framework to your target's Linked Frameworks and Libraries section and added this framework's path to the Input Files section for your target's copy framework's script phase for Carthage:
$(SRCROOT)/Carthage/Build/iOS/AerisMapboxMapKit.framework
AerisMapboxMapKit.framework
. Make sure to check the Destination: Copy items if needed checkbox when prompted.Once you have the AerisMapboxMapKit module installed in your project, just create your weather map instance specifying Mapbox as the map type:
self.weatherMap = [[AWFWeatherMap alloc] initWithMapType:AWFWeatherMapTypeMapbox];
weatherMap = AWFWeatherMap(mapType: .mapbox)
When using the Mapbox SDK with a weather map, the weather map and its internal objects must remain the sole delegate on the associated MGLMapView
instance. Therefore, you should NOT assign the delegate
method on your map view which will break the core weather map functionality.
Instead, just assign the mapViewDelegate
property on your AWFWeatherMap
instance to the object that should receive MGLMapViewDelegate
messages. These messages will get forwarded to the object assigned to this property by the weather map:
self.weatherMap.mapViewDelegate = self;
weatherMap.mapViewDelegate = self
Using mapping libraries other than Apple's MapKit may introduce limitations in what features or options are available for the third-party library. Currently, there are no known limitations when using the Mapbox SDK for iOS.
Last modified: July 30, 2020