Explore the project at github.com/roblabs/ios-map-ui
A starter project for Mapbox maps in iOS
brew install carthagecarthage updateMGLMapboxAccessToken key to the Info.plist.
Initial zoom and center


Empty Storyboard; all views added via code

A Mapbox map with UIBarButtonItem added using Swift, with minimal use of the storyboard.
UIBarButtonItem and code handlers to take action when they are clicked.
override func viewDidLoad() {
super.viewDidLoad()
// MARK:- UIBarButtonItem
self.navigationItem.leftBarButtonItem = UIBarButtonItem(
barButtonSystemItem: .search,
target: self,
action: #selector(handleLeftBarButton))
self.navigationItem.rightBarButtonItem = UIBarButtonItem(
barButtonSystemItem: .action,
target: self,
action: #selector(handleRightBarButton))
}
Initial zoom and center

Editor > Embed In > Navigation Controller

A Mapbox map with UISearchBar added using Swift, with minimal use of the storyboard.
UITableView pops up with filtered search resultsUISearchController is a mixture of Storyboards and Swift code.mapView is hidden or displayed.

To make a MapKit view without a storyboard
Info.plist, delete the key Main Storyboard file base nameIn your AppDelegate.swift, ```
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
if let window = window { window.backgroundColor = UIColor.white window.rootViewController = ViewController() window.makeKeyAndVisible() }
return true } ```