3 ms·
There's ConciseKit for precisely this problem: https://github.com/petejkim/ConciseKit https://github.com/petejkim/ConciseKit We use it in a lot of our code her
by chubs 15y ago
There's ConciseKit for precisely this problem: https://github.com/petejkim/ConciseKit https://github.com/petejkim/ConciseKit
We use it in a lot of our code here. Its quite nice. You'll end up with something like:
myDict = $mdict(val, key, val2, key2);
- freemarketteddy 15y agowow thts pretty cool!
- koenigdavidmj 15y agoAnd the values and keys are still backwards.
- stephth 15y ago#define KV(KEY,VALUE) VALUE, KEY myDict = MD(KV(key,val), KV(key2,val2)); Ugly but a case can be made that this end justifies the means. Another option is implementing your own dictionaryWithObjectsAndKeys where you flip the varargs and feed them back into the subclass dictionaryWithObjectsAndKeys.