PolygonState
PolygonState
Section titled “PolygonState”PolygonState is an ObservableObject used by Polygon(state:).
Use it when a filled area changes shape, style, holes, z-index, or selection state after creation.
Public Properties
Section titled “Public Properties”id: StringstrokeColor: UIColorstrokeWidth: DoublefillColor: UIColorgeodesic: BoolzIndex: Intpoints: [GeoPointProtocol]holes: [[GeoPointProtocol]]extra: Any?onClick: OnPolygonEventHandler?
Use alpha on fillColor or strokeColor for transparency.
let polygonState = PolygonState( points: outerRing, fillColor: UIColor.green.withAlphaComponent(0.25), holes: [innerRing])
Polygon(state: polygonState)
polygonState.strokeWidth = 3polygonState.fillColor = UIColor.red.withAlphaComponent(0.2)Updating Holes
Section titled “Updating Holes”holes is an array of rings inside the outer polygon:
polygonState.holes = [restrictedAreaRing]Use alpha on fillColor for translucent regions. Keep points and holes in the coordinate order required by your data model.