---
title: "init(axialSpace:start:end:function:extendStart:extendEnd:)"
framework: coregraphics
role: symbol
role_heading: Initializer
path: "coregraphics/cgshading/init(axialspace:start:end:function:extendstart:extendend:)"
---

# init(axialSpace:start:end:function:extendStart:extendEnd:)

Creates a shading object to use for axial shading.

## Declaration

```swift
init?(axialSpace space: CGColorSpace, start: CGPoint, end: CGPoint, function: CGFunction, extendStart: Bool, extendEnd: Bool)
```

## Parameters

- `space`: The color space in which color values are expressed. Core Graphics retains this object; upon return, you may safely release it.
- `start`: The starting point of the axis, in the shading’s target coordinate space.
- `end`: The ending point of the axis, in the shading’s target coordinate space.
- `function`: A CGFunction object created by the function doc://com.apple.coregraphics/documentation/CoreGraphics/CGFunction/init(info:domainDimension:domain:rangeDimension:range:callbacks:). This object refers to your function for creating an axial shading. Core Graphics retains this object; upon return, you may safely release it.
- `extendStart`: A Boolean value that specifies whether to extend the shading beyond the starting point of the axis.
- `extendEnd`: A Boolean value that specifies whether to extend the shading beyond the ending point of the axis.

## Return Value

Return Value A new Core Graphics axial shading. In Objective-C, you’re responsible for releasing this object using CGShadingRelease.

## Discussion

Discussion An axial shading is a color blend that varies along a linear axis between two endpoints and extends indefinitely perpendicular to that axis. When you are ready to draw the shading, call the function drawShading(_:).

## See Also

### Creating Shading Objects

- [init(radialSpace:start:startRadius:end:endRadius:function:extendStart:extendEnd:)](coregraphics/cgshading/init(radialspace:start:startradius:end:endradius:function:extendstart:extendend:).md)
