Skip to main content

Hello Map

Last updated: February 24, 2026 | 2 minutes read

This example demonstrates how to use GEMKit in a UIKit application to display a fully interactive map view.

Check the full implementation on GitHub.

MapViewController View

Map Display

The following code outlines the main view, which displays the map:

ViewController.swiftView on GitHub

class ViewController: UIViewController {

var mapViewController: MapViewController?

deinit {

if let controller = mapViewController {

controller.destroy()
}
}

override func viewDidLoad() {

super.viewDidLoad()

if let navigationController = self.navigationController {

let appearance = navigationController.navigationBar.standardAppearance

navigationController.navigationBar.scrollEdgeAppearance = appearance
}

self.createMapView()
}

override func viewWillAppear(_ animated: Bool) {

super.viewWillAppear(animated)

self.mapViewController!.startRender()
}

override func viewWillDisappear(_ animated: Bool) {

super.viewWillDisappear(animated)

self.mapViewController!.stopRender()
}

// MARK: - Map View

func createMapView() {

self.mapViewController = MapViewController.init()
self.mapViewController!.view.backgroundColor = UIColor.systemBackground

self.addChild(self.mapViewController!)
self.view.addSubview(self.mapViewController!.view)
self.mapViewController!.didMove(toParent: self)

self.mapViewController!.view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
self.mapViewController!.view.topAnchor.constraint(equalTo: self.view.topAnchor, constant: 0),
self.mapViewController!.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor, constant: 0),
self.mapViewController!.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor, constant: -0),
self.mapViewController!.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor, constant: -0)
])
}
}