Expand description
day-piece-map — an EXTERNAL Day Piece (DESIGN.md §15) wrapping the platform’s NATIVE map view,
APPLE PLATFORMS ONLY. It is the reference for a piece that deliberately does NOT support every
backend: AppKit and UIKit render a real MKMapView; on GTK/Qt/Android/XAML the map kind falls
back to day’s placeholder leaf (those features exist but register no renderer). One Rust API,
registered link-time into each Apple backend’s renderer slice without touching day.
map() shows a slippy map centered on a coordinate. Configure the region at build with
.center(lat, lon) + .span(degrees) (a smaller span zooms in) and drop a pin with
.marker(lat, lon). The center can also be bound reactively with .center_signal(signal) so a
preset button row or a location feed recenters the map live (a Center patch to the native view;
a Const center from .center seeds once and never patches). A map fills the space it’s offered
(a growing leaf), so constrain it with .frame(w, h). See docs/map.md for the per-backend caveats.
let where_to = Signal::new((37.7749, -122.4194)); // San Francisco
map()
.center_signal(where_to) // preset buttons `where_to.set(..)` recenter live
.span(0.05) // ~5 km across
.marker(37.7749, -122.4194)
.frame(320.0, 240.0)
.id("map");Structs§
- Map
- A native map view centered on a coordinate. Set the region with
.center()/.span(), drop a pin with.marker(), and optionally bind the center reactively with.center_signal(). - MapProps
- Full props (realize).
lat/lonseed the center (thereafter patched when the center is a reactive source), whilespanandmarkerare fixed at build time.
Enums§
- MapPatch
- Sparse reconcile patch — only the center moves after build (span/marker are fixed).
Constants§
- DEFAULT_
SPAN - The default zoom span (latitude/longitude delta, in degrees) — a few city blocks across.
- KIND
Functions§
- map
map()— a native map view (defaults to(0, 0)at the default span, no marker). Point it at a place with.center(lat, lon)(or.center_signal(..)to follow a coordinate signal).
Type Aliases§
- Coord
- A (latitude, longitude) coordinate in degrees.