Nullability Annotations in Objective-C
Objective-C's nullability annotations tell the compiler which pointers can be nil. They catch bugs at compile time and make your code bridge to Swift cleanly.
// 19 articles available
Objective-C's nullability annotations tell the compiler which pointers can be nil. They catch bugs at compile time and make your code bridge to Swift cleanly.
Objective-C's lightweight generics let you specify element types for collections like NSArray<NSString *>. They catch type mismatches at compile time and improve Swift bridging.
A refactoring mishap with arithmetic expressions led me down the rabbit hole of operator precedence differences between Swift and Objective-C. Here's what to watch for.
NSError is the standard error handling mechanism in Objective-C, but using it defensively requires more than just passing a pointer. Learn patterns that prevent crashes and make debugging easier.
Objective-C has four ways to represent nothing. Understanding when to use each prevents subtle bugs and clarifies your code's intent.
KVO lets you observe property changes without delegation or notifications. Here's how it works under the hood and how to use it correctly.
Before Swift closures, Objective-C had blocks. The syntax is different, but the power is the same. Here's how to use them effectively.
Every Objective-C class inherits from NSObject (usually). Here's what NSObject provides and why it matters for every object you create.
Both let you add methods to classes, but categories and class extensions serve different purposes. Here's when to use each.
Unlike C++ virtual methods, Objective-C uses dynamic message passing. Understanding this mechanism unlocks the language's full power.
Retain cycles are the most common memory leak in Objective-C. Learn how they form, how to detect them, and patterns that prevent them.
Objective-C lacks namespaces, so the community invented conventions. Here's how prefixes and other patterns help avoid collisions in a flat symbol space.
Objective-C is famous for verbose naming. Let's celebrate (or mourn) the longest method and class names hiding in Apple's standard libraries.
Objective-C supports exception handling with @try/@catch, but the community settled on NSError pointers instead. Here's why.
Swizzling is powerful but dangerous. Here are the common pitfalls and how to avoid turning your clever hack into a debugging nightmare.
Method swizzling lets you replace method implementations at runtime. Here's how it works and when this powerful technique shines.
Understand the class cluster pattern that makes NSString, NSArray, and NSDictionary work, and learn how to implement your own.
Discover how the Objective-C runtime secretly stores small strings directly in pointer values, eliminating heap allocations entirely.
Learn how dispatch barrier queues provide elegant reader-writer synchronization in Objective-C without explicit locks or semaphores.