---
title: MKGradientPolylineRenderer
framework: mapkit
role: symbol
role_heading: Class
path: mapkit/mkgradientpolylinerenderer
---

# MKGradientPolylineRenderer

A visual representation of any polyline overlay object with a gradient.

## Declaration

```swift
class MKGradientPolylineRenderer
```

## Overview

Overview This renderer only applies a stroke to the line; it doesn’t fill it. Set the gradients with setColors:atLocations: and pair colors to locations that MapKit represents as unit distance values along the distance of the polyline. Don’t subclass MKGradientPolylineRenderer. Use the class as-is. The gradient displays itself along the direction of the line.

## Topics

### Accessing the gradient colors

- [setColors(_:locations:)](mapkit/mkgradientpolylinerenderer/setcolors(_:locations:)-3xrou.md)
- [setColors(_:locations:)](mapkit/mkgradientpolylinerenderer/setcolors(_:locations:)-1tuft.md)
- [colors](mapkit/mkgradientpolylinerenderer/colors.md)
- [locations](mapkit/mkgradientpolylinerenderer/locations-7k6qz.md)

## Relationships

### Inherits From

- [MKPolylineRenderer](mapkit/mkpolylinerenderer.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Multiple segment lines

- [MKPolyline](mapkit/mkpolyline.md)
- [MKGeodesicPolyline](mapkit/mkgeodesicpolyline.md)
- [MKMultiPolyline](mapkit/mkmultipolyline.md)
- [MKPolylineRenderer](mapkit/mkpolylinerenderer.md)
- [MKMultiPolylineRenderer](mapkit/mkmultipolylinerenderer.md)
