Creating an NSDictionary by writing values inside curly braces

52 Views Asked by At

The NSDictionary class allows me to initialise it like this:

NSDictionary* attributes =
@{
  NSFontAttributeName: font
};

What is this construction method called, and how I can implement it in my own class? I want to have a class with properties that have default values, and I'd like to only set the ones I need during construction (in C++ I would have done this with default parameter values, but Objective-C does not have that), so this seemed like a legitimate approach. Or is this something NSDictionary specific?

0

There are 0 best solutions below