This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Macros for creating NSArray and NSSet objects as replacement for @[…] literal. | |
let components = NSArray(street, city, state, country); | |
// Advantages: | |
// 1. Type of NSArray is inferred, in this case it’s NSArray<NSString *> * | |
// 2. List of objects is type-checked, so mixing types like NSArray(@42, @"Hi") will report compilation error. | |
// 3. Ability to allocate any class, not just NSArray. For example NSSet and NSMutableArray. | |
// 4. Avoids stupid clang bracket matching bug, if you know what I mean. |