whatisgithub

What is libextobjc?

jspahrsummers/libextobjc — explained in plain English

Analysis updated 2026-06-26

4,505Objective-CAudience · developerComplexity · 2/5LicenseSetup · easy

In one sentence

A modular Objective-C library that adds missing language features, safer memory management macros, defer-style scope cleanup, and compile-time checked key paths, to iOS and macOS codebases.

Mindmap

mindmap
  root((libextobjc))
    What It Does
      Extend Objective-C
      Safer memory patterns
    Key Features
      weakify and strongify
      onExit defer
      Safe categories
    Target Platforms
      iOS
      macOS
    Use Cases
      Retain cycle prevention
      Scope cleanup
      Compile-time safety
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Use @weakify and @strongify in an iOS view controller to safely capture self in completion blocks without creating a retain cycle.

USE CASE 2

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.

USE CASE 3

Add methods to existing system classes with safe categories that warn at compile time if you accidentally overwrite a built-in method.

What is it built with?

Objective-CXcode

How does it compare?

jspahrsummers/libextobjcjohn-lluch/swrevealviewcontrollercolineberhardt/vctransitionslibrary
Stars4,5054,4914,531
LanguageObjective-CObjective-CObjective-C
Setup difficultyeasyeasyeasy
Complexity2/52/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Requires Automatic Reference Counting (ARC) to be enabled in your Xcode project.

Use freely in any project, commercial or personal, as long as you keep the copyright notice.

So what is it?

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.

Copy-paste prompts

Prompt 1
Show me how to use libextobjc's @weakify and @strongify macros in an Objective-C UIViewController to safely capture self in a network completion block without creating a retain cycle.
Prompt 2
Using libextobjc's @onExit macro, write an Objective-C method that locks a mutex at the start and guarantees it is unlocked no matter how the method exits.
Prompt 3
How do I use libextobjc's key path coding macros to get a compile-time-checked keyPath string for use with NSFetchRequest in Core Data?
Prompt 4
Show me how to import only the @weakify/@strongify module from libextobjc in a CocoaPods Podfile without pulling in the entire library.

Frequently asked questions

What is libextobjc?

A modular Objective-C library that adds missing language features, safer memory management macros, defer-style scope cleanup, and compile-time checked key paths, to iOS and macOS codebases.

What language is libextobjc written in?

Mainly Objective-C. The stack also includes Objective-C, Xcode.

What license does libextobjc use?

Use freely in any project, commercial or personal, as long as you keep the copyright notice.

How hard is libextobjc to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is libextobjc for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.