Agent skill · software engineering · thebushidocollective

Objective-C ARC Patterns

Use when automatic Reference Counting in Objective-C including strong/weak references, retain cycles, ownership qualifiers, bridging with Core Foundation, and patterns for memory-safe code without manual retain/release.

Why this skill is useful

Provides specific patterns and examples for memory management in Objective-C using ARC that the AI wouldn't reliably generate on its own.

What it needs

About 9k tokens when loaded. Last updated 2026-07-19. 187 stars on the source repository.

What this skill does

Objective-C ARC Patterns Introduction Automatic Reference Counting (ARC) is Objective-C's memory management system that automatically inserts retain and release calls at compile time. ARC eliminates most manual memory management while providing deterministic memory behavior and preventing common memory bugs like use-after-free and double-free. Unlike garbage collection, ARC provides immediate deallocation when reference counts reach zero, making it suitable for resource-constrained environments like iOS. Understanding ARC's ownership rules, qualifiers, and patterns is essential for writing memory-safe Objective-C code and avoiding retain cycles. This skill covers strong and weak references, ownership qualifiers, retain cycles, Core Foundation bridging, and best practices for ARC-based memory management. Strong and Weak References Strong references maintain ownership of objects and prevent deallocation, while weak references observe objects without preventing deallocation. Strong references increment retain count, while weak references are automatically set to nil when the object deallocates, preventing dangling pointers. Retain Cycles and Breaking Them Retain cycles occur when objects hold strong references to each other, preventing deallocation. Breaking cycles requires weak or unowned references. Always use weak references for delegates, parent pointers, and observers to break retain cycles. Use the weak-strong dance in blocks for safe self access. Ownership Qualifiers ARC provides ownership qualifiers that explicitly control memory management behavior for variables and properties. Choose copy for properties that accept mutable types like NSMutableString or NSMutableArray to prevent unexpected mutations. Core Foundation Bridging Core Foundation objects require explicit memory management and bridging to work correctly with ARC-managed Objective-C objects. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills thebushidocollective/objc-arc-patterns

View the source on GitHub

Browse the @skills marketplace