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

# init(dictionaryLiteral:automaticallyPlaysDefaultAnimation:)

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

## Declaration

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

## 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.
- `automaticallyPlaysDefaultAnimation`: Whether to automatically play the default animation when the entity is added to a scene and enabled. When true, the animation system plays the default animation automatically. When false, animations require manual playback. See doc://com.apple.RealityKit/documentation/RealityKit/AnimationLibraryComponent/automaticallyPlaysDefaultAnimation for details.

## Discussion

Discussion Use the ExpressibleByDictionaryLiteral initializer by directly assigning the library to a dictionary literal.

## See Also

### Configuring default playback

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