Weird objective-c syntax - square brackets and @ sign

后端 未结 2 1965
渐次进展
渐次进展 2020-12-11 06:23

I\'m using GHSidebarNav in one of my projects and I came across this code allocating an array of objects. I just have no idea what its doing. Is it just an array? What is th

2条回答
  •  暖寄归人
    2020-12-11 07:04

    These are array literals, a type of container literal, available in Xcode 4.4 and later.

    See:

    • "Literal syntax" section of the discussion of arrays in the Programming with Objective C
    • Objective-C Literals discussion at the LLVM site
    • WWDC 2012 Modern Objective-C, about 19-20 minutes into it
    • WWDC 2012 Migrating to Modern Objective-C

提交回复
热议问题