Objective-C Cheat Sheet
|
This section documents modern Objective-C as implemented by Apple Clang in the current Xcode release — Objective-C 2.0 plus ARC, literals and subscripting, This content was generated with the assistance of AI and should be verified against developer.apple.com before being relied on in production. This section’s bibliography lists the reference material consulted while preparing these pages. |
A single-page, colour-coded summary of the Objective-C essentials — the core types (id, BOOL, SEL,
nil), the @interface/@implementation skeleton, method declaration and message-send syntax,
alloc/init and the initializer patterns, the full @property attribute table, categories, class
extensions and protocols, block syntax with block and weak, literals and subscripting, NSString,
NSArray and NSDictionary quick examples, fast enumeration, the ARC ownership qualifiers and bridging
casts, the NSError and @try patterns, GCD one-liners, KVC and KVO calls, the runtime and Swift-interop
annotations, and the clang/gnustep-config build commands — handy for quick memorization or as a printable
desk reference.
For the full explanation, every option, and additional examples, see the dedicated pages:
Getting started — Getting Started, Basic Syntax and Types, and Operators, Control Flow and Functions.
Objects, classes and messaging — Classes and Objects, Messaging and Selectors, Properties and Encapsulation, Inheritance and Polymorphism, Categories and Extensions, Protocols and Delegation, and Blocks.
Foundation values and collections — Strings, Numbers and Values, Collections and Fast Enumeration, and Lightweight Generics and Nullability.
Memory management — Manual Retain Release and Automatic Reference Counting.
The runtime and dynamism — The Objective-C Runtime, Dynamic Method Resolution and Forwarding, and Key-Value Coding and Observing.
Error handling — Errors and Exceptions.
Concurrency — Concurrency.
Interoperability — Objective-C++ and C Interoperability and Swift Interoperability.
Code organisation and tooling — Modules, Frameworks and Code Organization, Coding Conventions and Style, Build and Tooling, and Testing.