Skip to Content
Getting Started

MapsGL iOS - Getting Started

Getting started with MapsGL is quick and easy and requires that you have an active Xweather Flex subscription .

Supported Mapping Libraries

MapsGL SDK for Apple Platforms currently supports integration with the following third-party mapping libraries:

Library + VersionControllerAdapter Library
Mapbox Maps , v11.x.xMapboxMapControllerMapsGLMapbox
MapLibre Native for iOS , v6.18.0+MapLibreMapControllerMapsGLMapLibre

Installing

Follow the series of steps outlined below for your desired method to get started using the Xweather MapsGL SDK for Apple Platforms:

Create an Xweather account

Sign up for an Xweather Weather API and Maps subscription  and setup your access keys as described in our Xweather Weather API’s getting started guide. We offer a free developer account  for you to give our weather API a test drive.

Add the MapsGL SPM Package

In your iOS app Xcode project or workspace:

  1. Run File menu ❯ Add Package Dependencies…. Or alternatively, navigate to your project settings’ Package Dependencies section.
  2. In the top-right “Search or Enter Package URL” field, type https://github.com/vaisala-xweather/mapsgl-apple-sdk.
  3. Click Add Package in the bottom-right.
  4. Choose the branch that matches the provider channel you want to consume:
    • master: latest Mapbox package channel
    • maplibre: latest MapLibre package channel
    • release/x.y.z: pinned Mapbox release line
    • release/maplibre/x.y.z: pinned MapLibre release line
  5. In the “Choose Package Products for mapsgl-apple-sdk” dialog, ensure your app target is selected under “Add to Target”, and click Add Package.

The SPM package manifest at the repo root is provider-specific per branch. The Mapbox branches resolve the Mapbox SDK and expose the Mapbox adapter product, while the MapLibre branches resolve MapLibre Native and expose the MapLibre adapter product.

A MapsGL static library will be added to your app target’s “Frameworks, Libraries, and Embedded Content” section, and Xcode will resolve the frameworks required by the MapsGL products you include.

Set up a map view

Set up an interactive map instance using your chosen provider. If you’re using Mapbox, follow the Mapbox Maps SDK for iOS installation instructions . If you’re using MapLibre, set up a MLNMapView using the MapLibre Native SDK.

Set up MapsGL with your map

Set up your Xweather account access keys  for the SDK, create the MapsGL map controller for your provider, and add a weather layer to the map. Use import MapsGLMaps plus import MapsGLMapbox for Mapbox or import MapsGLMapLibre for MapLibre.

See below for sample code to get started quickly using MapsGL with Mapbox.

The following Swift sample code shows a Mapbox-based setup. If you are using MapLibre instead, use the corresponding MapLibre map view along with MapLibreMapController from MapsGLMapLibre.

import SwiftUI import MapboxMaps import MapsGLMaps import MapsGLMapbox // Needed only if you are using SPM //import MapsGL // Needed only if you are using CocoaPods import Combine let xweatherClientID = "FILL_IN_WITH_YOUR_CLIENT_ID" let xweatherClientSecret = "FILL_IN_WITH_YOUR_CLIENT_SECRET" let mapboxAccessToken = "FILL_IN_WITH_YOUR_MAPBOX_PUBLIC_ACCESS_TOKEN" struct MyMapView : View { class Coordinator { /// MapsGL's controller that manages adding/removing MapsGL weather layers to/from the `MapboxMaps.MapView`. var mapController: MapboxMapController! /// Holds Combine subscriptions to MapsGL events and other Combine subscriptions. var cancellables: Set<AnyCancellable> = [] } private let coordinator = Coordinator() var body: some View { MapReader { proxy in Map(initialViewport: .camera( center: CLLocationCoordinate2D(latitude: 50.0, longitude: 10.0), zoom: 2.5 )) .mapStyle(.dark) .ignoresSafeArea() .onAppear { guard let map = proxy.map else { return } try! map.setProjection(.init(name: .mercator)) // Set 2D map projection // Set up the MapsGL `MapboxMapController`, which will handle // adding/removing MapsGL weather layers to the `MapboxMaps.MapView`. let mapController = MapboxMapController( map: map, window: UIWindow?.none, account: XweatherAccount(id: xweatherClientID, secret: xweatherClientSecret) ) coordinator.mapController = mapController // Once the map has completed initial load… mapController.subscribe(to: MapEvents.Load.self) { _ in // Add the wind particles layer. do { var layerConfig = WeatherService.WindParticles(service: mapController.service) layerConfig.layer.paint.particle.density = .extreme try mapController.addWeatherLayer(config: layerConfig) } catch { NSLog("Failed to add weather layer: \(error)") } }.store(in: &coordinator.cancellables) } } } private static let _staticInit: Void = { MapboxOptions.accessToken = mapboxAccessToken }() private let _staticInit: Void = Self._staticInit } #Preview { MyMapView() }

A full example of how to set up MapsGL with Mapbox with SwiftUI can be found in the mapsgl-apple-sdk repository’s Demo directory , particularly in this content view .

© 2026 Xweather (opens in a new tab)Terms of Service (opens in a new tab)Privacy Policy (opens in a new tab)