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

# init(dictionaryLiteral:)

Creates an XPCDictionary initialized with the given key-value pairs.

## Declaration

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

## Parameters

- `elements`: The key-value pairs that will make up the new dictionary. Values can be strings, integers, booleans, floating-point numbers, or other XPC-compatible types.

## Discussion

Discussion Example usage: let dict: XPCDictionary = [     "name": "John",     "age": 30,     "isActive": true,     "score": 95.5 ] For more complex types, you can explicitly create XPCLiteralValue: let dict: XPCDictionary = [     "nested": XPCLiteralValue(anotherDict),     "endpoint": XPCLiteralValue(someEndpoint) ]
