What does the dollar sign mean in objective-c?

CAGradientLayer *grad = [CAGradientLayer layer]; grad.colors = $array(ColRGBA2(1, 0, 0, 1), ColRGBA2(0, 1, 0, 1), ColRGBA2(0, 0, 1, 1), ColRGBA2(0, 0, 0, 0)); grad.startPoint = CGPointMake(0, 0); grad.endPoint = CGPointMake(1, 0); grad.colors = $array(ColRGBA2(1, 0, 0, 1), ColRGBA2(0, 1, 0, 1), ColRGBA2(0, 0, 1, 1), ColRGBA2(0, 0, 0, 0)); 

there is a dollar sign in this sentence, what does this mean? any links about this?

+6
c objective-c iphone macos
source share
2 answers

This is not a feature of the language; it is a convenient integrator for collections that some people use. For example:

 $array(foo, bar, baz) 

expands to:

 [NSArray arrayWithObjects:foo, bar, baz, nil] 

I am not sure if this is a problem. And I don't have a link to the library that provides these macros, maybe someone else does?

By the way, it looks like we will have official literals for arrays, dictionaries, and some other objects in Xcode 4.4. Details appear to be under the NDA at the moment, but there is some discussion in Hacker News .

+12
source share

This is from the ConciseKit library

https://github.com/petejkim/ConciseKit

+2
source share

All Articles