Creating a basic map using Mapbox GL
In this recipe, you will learn how to create basic maps with the help of Mapbox GL.
How to do it…
Now that we have integrated Mapbox GL into our project, it's time to learn the basics of the framework. In this recipe, we will create a basic app that shows a Mapbox GL map on screen. Here are the steps:
We will continue from the last step of the previous recipe after we have successfully linked and built our new project.
Open the
Main.storyboard
file. Storyboards allow us to visually create user interfaces. The current storyboard already containsViewController
. We will add a newMGLMapView
.Make sure that the Utilities sidebar is visible. If not, click on the Hide or Show Utilities button in the upper-right corner of Xcode. In the lower half of the Utilities sidebar, make sure that Objects are selected.
A list of the available UI elements will be visible. Find
UIView
and drag it intoUIViewController
in the storyboard. As you dragUIView
, you will notice that...