---
title: "init(starting:ending:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nsgradient/init(starting:ending:)"
---

# init(starting:ending:)

Initializes a newly allocated gradient object with two colors.

## Declaration

```swift
convenience init?(starting startingColor: NSColor, ending endingColor: NSColor)
```

## Parameters

- `startingColor`: The starting color of the gradient. The location of this color is fixed at 0.0.
- `endingColor`: The ending color of the gradient. The location of this color is fixed at 1.0.

## Return Value

Return Value The initialized NSGradient object.

## See Also

### Creating a Gradient

- [init(colors:)](appkit/nsgradient/init(colors:).md)
- [init(colorsAndLocations:)](appkit/nsgradient/init(colorsandlocations:).md)
- [init(colors:atLocations:colorSpace:)](appkit/nsgradient/init(colors:atlocations:colorspace:).md)
- [init(coder:)](appkit/nsgradient/init(coder:).md)
