---
title: "init(attribute:)"
framework: gameplaykit
role: symbol
role_heading: Initializer
path: "gameplaykit/gkdecisiontree/init(attribute:)"
---

# init(attribute:)

Creates a decision tree starting with the specified initial attribute to test.

## Declaration

```swift
init(attribute: any NSObjectProtocol)
```

## Parameters

- `attribute`: The first attribute to test (or question to answer) when evaluating the tree.

## Return Value

Return Value A new decision tree.

## Discussion

Discussion The decision tree returned by this initializer is incomplete. To build a manually defined tree, use the rootNode property to access the node corresponding to the initial attribute, and use GKDecisionNode methods on that object to create branches leading to child nodes that represent additional attributes to test or final actions.

## See Also

### Creating a Manually Defined Decision Tree

- [rootNode](gameplaykit/gkdecisiontree/rootnode.md)
