applemaps

package
v0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package applemaps shows Apple Maps inside your screen, on iOS. It needs no key and no billing account. Apple Maps has no Android SDK, so on Android it shows Fallback: a googlemaps.Map, say, or a list of places.

nimbus native plugin add apple-maps

applemaps.Map{
	Center: applemaps.LatLng{Latitude: 18.53, Longitude: 73.89}, Zoom: 14,
	Markers: []applemaps.Marker{{ID: "cafe", At: cafe, Title: "Monsoon Coffee"}},
	OnMarker: open,
	Style: ui.Style{Grow: 1},
}

LatLng and Polyline match googlemaps', field for field, so they convert with a cast, and one screen can feed both maps.

Index

Constants

This section is empty.

Variables

View Source
var WebToken = os.Getenv("MAPKIT_JS_TOKEN")

LatLng is a place. WebToken is the MapKit JS token the web uses, from MAPKIT_JS_TOKEN unless you set it: a JWT you make with a Maps ID and key in your Apple developer account, limited to your site's origin. Without one, the web shows Fallback, as Android does.

Functions

This section is empty.

Types

type Kind

type Kind string

Kind is how the map is drawn.

const (
	Standard  Kind = ""          // streets and places
	Satellite Kind = "satellite" // photos from above
	Hybrid    Kind = "hybrid"    // photos, with streets and names
)

Kinds of map.

type LatLng

type LatLng struct {
	Latitude  float64 `json:"lat"` // in degrees
	Longitude float64 `json:"lng"` // in degrees
}

type Map

type Map struct {
	Center     LatLng     // where it looks
	Zoom       float32    // as on Google Maps: 0 is the world, 20 a building; 0 means 12
	Markers    []Marker   // the pins
	Lines      []Polyline // routes and other lines
	Kind       Kind       // Standard, Satellite or Hybrid
	MyLocation bool       // the blue dot; needs the location permission

	OnTap    func(LatLng)          // the map itself
	OnMarker func(id string)       // a pin
	OnMove   func(LatLng, float32) // after a pan or zoom ends, with the zoom
	Style    ui.Style              // the map's size and place on the screen

	// Fallback is shown instead on Android, in the same Style. Nil shows an
	// empty space.
	Fallback ui.Component
}

Map is a map. Changing Center or Zoom moves it there; panning by hand doesn't change them, and OnMove says where it stopped.

func (Map) Render

func (m Map) Render(c *ui.Ctx) ui.Component

Render shows the map, or Fallback on Android.

type Marker

type Marker struct {
	ID       string `json:"id"`                 // your name for it, sent to OnMarker
	At       LatLng `json:"at"`                 // where it stands
	Title    string `json:"title,omitempty"`    // shown under the pin; optional
	Subtitle string `json:"subtitle,omitempty"` // shown when it's selected; optional
}

Marker is a pin.

type Polyline

type Polyline struct {
	Points []LatLng `json:"points"` // the places it goes through
	Color  ui.Color `json:"color"`  // the theme's Primary when 0
	Width  float32  `json:"width"`  // points; 0 means 4
}

Polyline is a line through places, such as a route.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL