---
title: "init(session:name:)"
framework: opendirectory
role: symbol
role_heading: Initializer
path: "opendirectory/odnode/init(session:name:)"
---

# init(session:name:)

Creates a node object with a specified session and name.

## Declaration

```swift
init(session inSession: ODSession!, name inName: String!) throws
```

## Parameters

- `inSession`: The session.
- `inName`: The name of the node.

## Return Value

Return Value The created node object.

## Discussion

Discussion note: In Swift, this API is imported as an initializer and is marked with the throws keyword to indicate that it throws an error in cases of failure. You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.

## See Also

### Creating and Initializing a Node

- [init(session:type:)](opendirectory/odnode/init(session:type:).md)
