<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/AnimationLibraryComponent/init(dictionaryLiteral:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation25AnimationLibraryComponentV17dictionaryLiteralACSS_AA0C8ResourceCtd_tcfc"
  },
  "title" : "init(dictionaryLiteral:)"
}
-->

# init(dictionaryLiteral:)

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

```
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

Use the
<doc://com.apple.documentation/documentation/Swift/ExpressibleByDictionaryLiteral>
initializer by directly assigning the library to a dictionary literal.

```swift
let animationLibrary: AnimationLibraryComponent = [
    "idle": idleAnimation,
    "walk": walkAnimation
]
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)