<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MapKit",
  "identifier" : "/documentation/MapKit/MapPolyline",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "MapKit",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:15_MapKit_SwiftUI0A8PolylineV"
  },
  "title" : "MapPolyline"
}
-->

# MapPolyline

An open polygon overlay consisting of one or more connected line segments.

```
struct MapPolyline
```

## Overview

Use this view to create map polylines instances in the closure you provide to the `content` parameter in the [`Map`](/documentation/MapKit/Map) initializers.

## Topics

### Creating a polyline

[`init(_:)`](/documentation/MapKit/MapPolyline/init(_:)-93u7w)

Creates a polyline from polyline you provide.

[`init(_:)`](/documentation/MapKit/MapPolyline/init(_:)-5p2kx)

Creates a polyline that traces the route you provide.

[`init(coordinates:contourStyle:)`](/documentation/MapKit/MapPolyline/init(coordinates:contourStyle:))

Creates a polyline that traces a path between the given coordinates using the specifed contour style.

[`init(points:contourStyle:)`](/documentation/MapKit/MapPolyline/init(points:contourStyle:))

Creates a new polyline that traces a path between the provided points using the specifed contour style.

### Styling the polyline

[`stroke(_:lineWidth:)`](/documentation/MapKit/MapContent/stroke(_:lineWidth:))

Applies the given shape style to drawn map overlays using the line width you specify.

[`stroke(_:style:)`](/documentation/MapKit/MapContent/stroke(_:style:))

Applies the given shape style to drawn map overlays using the stroke style you specify.

[`stroke(lineWidth:)`](/documentation/MapKit/MapContent/stroke(lineWidth:))

Applies the given stoke drawn map overlays using the line width you specify.

[`strokeStyle(style:)`](/documentation/MapKit/MapContent/strokeStyle(style:))

Applies the given stroke style to drawn map overlays.

[`MapPolyline.ContourStyle`](/documentation/MapKit/MapPolyline/ContourStyle)

Values that define how MapKit styles lines to represent the contour of the Earth.

### Setting the overlay level

[`mapOverlayLevel(level:)`](/documentation/MapKit/MapContent/mapOverlayLevel(level:))

Specifies the position of overlays relative to other map content.

### Type aliases

[`Body`](/documentation/MapKit/MapContent/Body-swift.associatedtype)

The content and behavior of the view.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)