Creates a dictionary initialized with a dictionary literal.
SDK
- Xcode 6.1+
Framework
- Swift Standard Library
Declaration
Parameters
elements
The key-value pairs that will make up the new dictionary. Each key in
elements
must be unique.
Discussion
Do not call this initializer directly. It is called by the compiler to handle dictionary literals. To use a dictionary literal as the initial value of a dictionary, enclose a comma-separated list of key-value pairs in square brackets.
For example, the code sample below creates a dictionary with string keys and values.