Objective-C Finally Cleaned With LLVM4.0

XCode 4.4 will be using LLVM 4.0, with Clang extensions, which power Objective-C with clean literals. Here's the cheatsheet

NSNumber

1
2
3
4
5
6
7
8
9
10
@'Z'
@42
@42U // unsigned
@42LL
@3.1F // float
@3.1 // double
@YES
@NO
@true // obj-c++ only
@false // obj-c++

Containers

NOTE: Immutable

1
2
3
4
5
@[ @"hello", @3 ]
@{
@"name": @"jack",
@"class": @"deus"
}

Subscripting

1
2
3
4
array[idx]
array[idx] = somthing
dict[key]
dict[key] = somthing

Any objects with the following messages can use subscripting:

1
2
3
4
objectAtIndexedSubscript:
setObject:atIndexedSubscript:
objectForKeyedSubscript:
setObject:forKeyedSubscript:

Other benefits from Clang extensions:

  • Can ignore @synthesize
  • (Fixed sized) vector and shuffle vectors

Comments