CircleState
CircleState
Section titled “CircleState”CircleState is an ObservableObject used by Circle(state:).
Use it when the circle’s center, radius, style, z-index, or click behavior changes after the map content is first rendered.
Public Properties
Section titled “Public Properties”id: Stringcenter: GeoPointProtocolradiusMeters: Doublegeodesic: Boolclickable: BoolstrokeColor: UIColorstrokeWidth: DoublefillColor: UIColorzIndex: Int?extra: Any?onClick: OnCircleEventHandler?
Use radiusMeters for the circle size. Use alpha on fillColor or strokeColor for transparency.
let circleState = CircleState( center: GeoPoint(latitude: 35.6812, longitude: 139.7671), radiusMeters: 500, fillColor: UIColor.blue.withAlphaComponent(0.2))
Circle(state: circleState)
circleState.radiusMeters = 1_000circleState.center = GeoPoint(latitude: 35.6895, longitude: 139.6917)Selection Example
Section titled “Selection Example”circleState.onClick = { event in selectedCircleId = event.state.id}
circleState.strokeColor = selectedCircleId == circleState.id ? .red : .blueKeep id stable when a circle represents a model object such as a geofence or search area.