Skip to content

Repository files navigation

MapConductor Core

Description

MapConductor Core is the foundation library of the MapConductor iOS SDK. It provides the shared data types, SwiftUI overlay components, and abstraction interfaces used across all map implementations (Google Maps, MapLibre, MapKit, Mapbox, ArcGIS, etc.).

App developers use types from this module (e.g. GeoPoint, MarkerState, DefaultMarkerIcon) directly, regardless of which map implementation they choose. The actual map view (GoogleMapView, MapLibreMapView, etc.) is provided by each implementation module.

Setup

https://docs-ios.mapconductor.com/setup/

Data Types

GeoPoint

// From latitude / longitude
letpoint=GeoPoint(latitude:35.6762, longitude:139.6503)
// Convenience constructors
letpoint=GeoPoint.fromLatLong(35.6762,139.6503)letpoint=GeoPoint.fromLongLat(139.6503,35.6762)

GeoRectBounds

letbounds=GeoRectBounds(
southWest:GeoPoint(latitude:35.0, longitude:139.0),
northEast:GeoPoint(latitude:36.0, longitude:140.0))

MapCameraPosition

letcameraPosition=MapCameraPosition(
position:GeoPoint(latitude:35.6762, longitude:139.6503),
zoom:14,
bearing:45,
tilt:30)

Marker Icons

DefaultMarkerIcon (color fill)

leticon=DefaultMarkerIcon(
fillColor:UIColor.red,
strokeColor:UIColor.white,
label:"Tokyo",
labelTextColor:UIColor.white
)

ImageDefaultIcon (image fill)

leticon=ImageDefaultIcon(
backgroundImage: uiImage,
label:"Tokyo")

Overlay Components

All overlay components are available inside any XxxMapView content block.

Marker

letmarkerState=MarkerState(
position:GeoPoint(latitude:35.6762, longitude:139.6503),
icon:DefaultMarkerIcon(label:"Tokyo", fillColor:UIColor.blue),
onClick:{ state in
state.animate(.bounce)})XxxMapView(state: mapState){Marker(state: markerState)}

MarkerAnimation

// Available animations
MarkerAnimation.bounce
MarkerAnimation.drop
markerState.animate(.bounce)

InfoBubble

@StateprivatevarselectedMarker:MarkerState?=nilXxxMapView(state: mapState){Marker(state: markerState)iflet selected = selectedMarker {InfoBubble(marker: selected){Text("Hello, world!")}}}

Circle

Circle(
center:GeoPoint(latitude:35.6762, longitude:139.6503),
radiusMeters:500,
fillColor:UIColor.blue.withAlphaComponent(0.3),
strokeColor:UIColor.blue
)

Polyline

Polyline(
points:[GeoPoint(latitude:35.6762, longitude:139.6503),GeoPoint(latitude:35.6895, longitude:139.6917),],
strokeColor:UIColor.red,
strokeWidth:4)

Polygon

Polygon(
points: points,
fillColor:UIColor.green.withAlphaComponent(0.4),
strokeColor:UIColor.green
)

GroundImage

GroundImage(
bounds:GeoRectBounds(
southWest:GeoPoint(latitude:35.0, longitude:139.0),
northEast:GeoPoint(latitude:36.0, longitude:140.0)),
image: uiImage,
opacity:0.7)

RasterLayer

RasterLayer(
source:RasterLayerSource.xyz("https://tile.openstreetmap.org/{z}/{x}/{y}.png"))

About

MapConductor Core module for SwiftUI

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages