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 ¶
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 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.
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.