CocoaPods trunk is moving to be read-only. Read more on the blog, there are 17 months to go.

PhunwareMapping 1.9.3

PhunwareMapping 1.9.3

Maintained by Troy Stump, Jenkins Phunware.



 
Depends on:
PhunwareFoundation~> 1.1.0
PhunwareNetworking~> 1.3.0
PhunwareTheming~> 1.1.0
PhunwarePermissionPriming/Location~> 1.5.0
PWMapKit~> 3.16.1
 

Phunware Mapping

Version License Platforms Twitter

Phunware Mapping is a module that provides mapping and routing functionalities.

Requirements

  • iOS 15.5+
  • Xcode 16+

Installation

CocoaPods

It is required to use CocoaPods 1.15.2 or newer. Simply add the following to your Podfile:

pod 'PhunwareMapping', git: 'https://github.com/phunware/maas-mapping-module-ios.git', :tag => '1.9.2'

Setup

To use any Phunware SDKs or Modules, you'll need to provide an App ID and Access Key during initialization via your application delegate's application(_:didFinishLaunchingWithOptions:) method:

import PWCore

...

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
    // App ID and Access Key can be found for your application in the MaaS portal at: http://maas.phunware.com/clients
    PWCore.setApplicationID("APPLICATION_ID", accessKey: "ACCESS_KEY")
    ...
}

Usage

Permissions

Precise Location permission is required for real-time location updates and blue dot tracking on the map. Priming the user for and requesting permissions is achieved by starting a PermissionCoordinator:

let permissionNavigationController = UINavigationController()
permissionNavigationController.modalPresentationStyle = .fullScreen
navigationController.present(permissionNavigationController, animated: true)

let coordinator = PermissionCoordinator(navigationController: permissionNavigationController,
                                        mapLocalization: mapLocalization,
                                        themeConfiguring: mapThemeConfigurator)
coordinator.delegate = self
cordinator.start()

Routing

After precise location permission has been granted, launching the mapping experience is achieved by starting a POICoordinator:

let coordinator = POICoordinator(navigationController: navigationController,
                                 mapConfig: mapConfig,
                                 mapLocalization: mapLocalization,
                                 mapContainerSelector: mapContainerSelector,
                                 themeConfiguring: mapThemeConfigurator,
                                 allowsBackgroundLocationUpdates: false,
                                 meetingRoomPOIIdentifiers: [],
                                 initialMeetingRoomPOIImageSize: nil)
coordinator.delegate = self
coordinator.start()

Theming

To configure theming, pass an object that conforms to ThemeConfiguring protocol when initializing POICoordinator, RoutingCoordinator, or ShareLocationCoordinator.

The module provides a default MapThemeConfigurator which allows theming configurations using ColorPalette and TextStyles:

let themeConfigurator = MapThemeConfigurator(
    colors: ColorPalette(
        primary: .systemBlue,
        secondary: .systemCyan,
        primaryVariant: .systemBlue,
        secondaryVariant: .systemCyan,
        background: .systemBackground,
        surface: .label,
        onPrimary: .label,
        onSecondary: .label,
        onBackground: .label,
        onSurface: .label,
        error: .systemRed,
        onError: .secondaryLabel
    ),
    texts: TextStyles(
        headline1: .boldSystemFont(ofSize: 28),
        headline2: .boldSystemFont(ofSize: 18),
        headline3: .systemFont(ofSize: 16),
        subtitle1: .boldSystemFont(ofSize: 16),
        subtitle2: .boldSystemFont(ofSize: 14),
        body1: .systemFont(ofSize: 14),
        body2: .systemFont(ofSize: 12),
        overline: .systemFont(ofSize: 12),
        caption: .boldSystemFont(ofSize: 12),
        button: .boldSystemFont(ofSize: 14)
    )
)

let coordinator = POICoordinator(
    ...
    themeConfiguring: themeConfigurator
)