We just released version 0.5.0 of the MapBox iOS SDK, the latest update to our open source alternative to Apple’s MapKit for iPhone and iPad apps. I’d like to highlight three of the biggest features that we’re bringing to developers in this release: the background tile downloader, annotation convenience classes, and callouts.
Background tile downloader
Ever since we announced our unlimited map tile caching policy earlier this year, we’ve been wanting to make it easier for developers to download maps for offline use later. We’ve now added that functionality to the RMTileCache class, allowing start, cancellation, and progress reporting of background tile downloads, even without any user interface elements. You can have complete control over the bounding boxes and zoom ranges of downloads.
You could very easily allow a user the ability to download a region of the map before going overseas for vacation, then operate the map completely offline once they get there. Apps like Bass Pro Shops MyGuide: Hunt already have this functionality, but now we make it easier for developers to do it with fewer lines of code. There is a huge amount of flexibility with this and we are excited to see what developers cook up with these tools. And speaking of fewer lines of code…
Annotation convenience classes
Previously, when creating map annotations, you had to either provide a layer upfront or respond to delegate callbacks to provide one when needed. When it came to simple annotations like points (the most commonly-used annotation) or shapes connecting points, you would have to both specify the data and the drawing steps to create the visible layers. Now, there three new convenience classes - RMPointAnnotation, RMPolylineAnnotation, and RMPolygonAnnotation - which are designed with initializers meant to receive all the data in one step. They automatically take care of drawing their layers when needed, making efficient use of memory but more importantly, of developer time. You can now add a point to a map with a single line passing the coordinate and title in one step. The point is added and automatically has its callout title set. Which brings me to…
Going hand in hand with our new annotation convenience classes, all annotations now have the ability to display callouts on the map. These callouts are based on the excellent SMCalloutView and behave just like their counterparts in MapKit.
These callouts animate, respond to user actions, and order themselves above other annotations just like MapKit, too. And they have support for left and right accessory views, user interaction with those views, and auto-sizing and placement based on the map conditions. Point annotations have support for these callouts automatically, but any annotation can simply have its canShowCallout switch flipped to add support in one easy step.
Other new features
Here’s a sampling of some of the other features and fixes that we’ve rolled into this release:
Support for MapBox map ID alongside TileJSON for easier map tile source use.
SDK resources such as images now install in a single MapBox.bundle file instead of individually.
Removed the dependent build of the Proj4 projection library to greatly speed up compilation time.
Improvements to asynchronous map tile render speed and reliability.
Improved z-index sorting of cluster, point, and shape annotation layers.
Cleaned and reorganized Xcode project groups for simplicity.
Get it now
You can install the MapBox iOS SDK via one of three methods outlined in our SDK guide including CocoaPods, a pre-built binary framework, or as an Xcode sub-project with full source code access.
We hope that you enjoy these improvements. You can use the support forum for questions on getting setup, the issue tracker for reporting problems or requesting features, or you can contact me on Twitter at @incanus77.