Skip to main content

iOS Native - Location indicator

Location indicator

Enabling user location indicator will render a view on the map that shows the device's current location.

Enable the default user location indicator using the following code:

map.userTrackingMode = .followWithHeading

Change view style

There are several options to customize the appearance of the location indicator using UserLocationStyle.

  • By modifying colors of default userLocationViewStyle:

    map.userLocationManager.userLocationViewStyle = .init(
    foregroundTintColor: .systemPink,
    backgroundTintColor: .black,
    headingTintColor: .green,
    outOfActiveLevelStyle: .init(
    foregroundTintColor: .darkGray,
    headingTintColor: .red,
    alpha: 0.5
    )
    )
  • By modifying images of default userLocationViewStyle:

    let foreground = UIImage(named: "UserPuckIcon")
    let heading = UIImage(named: "UserArrow")

    map.userLocationManager.userLocationViewStyle = .init(
    foregroundImage: foreground,
    backgroundImage: UIImage(named: "UserIcon"),
    headingImage: heading,
    outOfActiveLevelStyle: .init(
    foregroundImage: foreground,
    headingImage: heading
    )
    )

Examples

You can find additional examples for the WemapSDKs on GitHub. Clone the repository and run the example application following the instructions in the README.