init(dictionaryLiteral:)
Creates an XPCDictionary initialized with the given key-value pairs.
Declaration
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
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)
]