---
title: "init(name:type:)"
framework: spritekit
role: symbol
role_heading: Initializer
path: "spritekit/skattribute/init(name:type:)"
---

# init(name:type:)

Creates and initializes a new attribute object of a specified type with a name that can be referenced within the shader.

## Declaration

```swift
init(name: String, type: SKAttributeType)
```

## Parameters

- `name`: The name of the attribute.
- `type`: The type of the attribute.

## Return Value

Return Value A new attribute object.

## Discussion

Discussion Attribute names are typically named with a preceding “a” and an underscore. The following code shows how to initialize an attribute named a_frequency which is of type SKAttributeType.float. let attribute = SKAttribute(name: "a_frequency",                              type: SKAttributeType.float)
