Use @weakify and @strongify in an iOS view controller to safely capture self in completion blocks without creating a retain cycle.
Use @onExit to guarantee a mutex is unlocked or a file is closed when a method scope exits, regardless of which return path is taken.
Add methods to existing system classes with safe categories that warn at compile time if you accidentally overwrite a built-in method.
Requires Automatic Reference Counting (ARC) to be enabled in your Xcode project.
libextobjc is a collection of extensions for Objective-C, the programming language historically used to build apps for Apple platforms like iOS and macOS. The library adds language-level features that Objective-C does not include on its own, borrowing patterns from other programming languages to make common tasks safer and more expressive. The most widely used piece is a pair of macros called @weakify and @strongify, which solve a recurring problem in Objective-C code: when you write a block of code that refers to an object, it is easy to accidentally create a retain cycle, where the object and the block each keep each other alive permanently and nothing ever gets freed from memory. These macros make the safe pattern for avoiding that problem much shorter to write. Another popular feature is @onExit, which runs a block of code automatically when the current scope ends, similar to the "defer" keyword in other languages. It is typically used to release memory, unlock mutexes, or close files, regardless of how the scope exits. Other features include safe categories, which let you add methods to existing classes and get a compiler warning if you accidentally overwrite a method that is already there. Concrete protocols let you define default method implementations in a protocol, something Objective-C's protocol system did not natively support before this library. Key path coding adds compile-time checking of key paths, catching typos that would otherwise only surface as runtime crashes. The library is built to be modular: most of its components have only one or two dependencies on other parts, so you can include only the pieces you need rather than the whole library. The project requires ARC (Automatic Reference Counting), a memory management mode in Objective-C. It is released under the MIT License. While Objective-C development has declined in favor of Swift, many existing iOS codebases still use Objective-C, and some of the patterns from this library influenced later Swift standard library designs.
← jspahrsummers on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.