---
title: "init(dictionaryLiteral:)"
framework: realitykit
role: symbol
role_heading: Initializer
path: "realitykit/animationlibrarycomponent/init(dictionaryliteral:)"
---

# init(dictionaryLiteral:)

Creates an animation library from a variadic list of key-value pairs.

## Declaration

```swift
init(dictionaryLiteral elements: (String, AnimationResource)...)
```

## Parameters

- `elements`: A list of key-value pairs that make up the dictionary. Each key is a unique animation name, and each value is an animation resource.

## Discussion

Discussion Use the ExpressibleByDictionaryLiteral initializer by directly assigning the library to a dictionary literal. let animationLibrary: AnimationLibraryComponent = [     "idle": idleAnimation,     "walk": walkAnimation ]

## See Also

### Creating an animation library component

- [init()](realitykit/animationlibrarycomponent/init().md)
- [init(animations:)](realitykit/animationlibrarycomponent/init(animations:).md)
