Category: Objective-C

Objective-C
Object Property Default Initialization Rules Explained

By Seren  |  03 Oct, 2026
Leave a comment

I once shipped a download settings model with a retry limit that quietly started at zero. Nothing crashed, and the debugger showed a perfectly valid value. The problem was that zero was a memory default, while the product expected three retries. I had confused safe initialization with correct business configuration. Objective-C gives newly allocated object […]

Objective-C
Strong, Weak, Assign: The Essential Difference

By Seren  |  02 Oct, 2026
Leave a comment

The difference between strong, weak, and assign became real to me while debugging a download screen that would not disappear. The coordinator kept working correctly, but the screen stayed in memory after navigation. The cause was not ARC itself. I had accidentally made the coordinator own its delegate. Changing the delegate to weak fixed the […]

Objective-C
Runtime Dynamic Method Addition and Method Swizzling in Practice: From Principles to Black Magic

By Seren  |  01 Oct, 2026
Leave a comment

I first used method swizzling in a checkout feature that needed temporary timing logs around an existing service method. The tempting solution was to exchange implementations at application launch and forget about it. That worked in a test build, but it also made every call site depend on a global behavior change that was difficult […]

Objective-C
ARC Automatic Memory Management: Core Decision Logic

By Seren  |  30 Sep, 2026
Leave a comment

ARC became easier for me to reason about when I stopped trying to predict an invisible reference count after every line. In one resource-loading feature, a downloaded image stayed alive after the request finished. The request was not the owner anymore, but a dictionary cache still was. The fix came from finding that ownership path, […]

Objective-C
Block Underlying Structure and Variable Capture Explained

By Seren  |  28 Sep, 2026
1 Comment

I understood Objective-C Blocks much better after I stopped treating variable capture as a list of interview rules. The problem became concrete while I was building a small batch uploader. Each queued operation needed to remember its file name, all operations needed to update one retry budget, and the coordinator needed a progress callback without […]

Objective-C
Deep Copy and Shallow Copy: The Complete Memory Change Principle

By Seren  |  20 Sep, 2026
Leave a comment

I once treated “deep copy” and “shallow copy” as two simple vocabulary items: one duplicates everything, while the other only duplicates an address. That explanation was easy to remember, but it was not useful when a real bug appeared in an iOS project. The outer objects had different addresses, yet editing one screen still changed […]

Objective-C
Objective-C Object Instance Memory Structure: An In-Depth Analysis

By Seren  |  18 Sep, 2026
Leave a comment

The first time I tried to budget memory for a large Objective-C import, I made a neat spreadsheet and got the wrong answer. Each parsed record had an integer, a flag, and a title, so I counted those fields, multiplied by the number of records, and expected Instruments to agree. The process used considerably more […]

Objective-C
Root Class NSObject Internal Implementation Principle

By Seren  |  17 Sep, 2026
Leave a comment

I once blamed NSObject for a memory problem that it did not cause. An import feature in one of my Objective-C tools created thousands of short-lived job objects. Instruments showed a larger memory increase than my rough calculation predicted, so I assumed that every object carried a mysterious fixed amount of hidden NSObject data. That […]

Objective-C
Instance Methods vs Class Methods: Where They’re Stored

By Seren  |  16 Sep, 2026
Leave a comment

I finally learned where Objective-C methods are stored after I wrote the wrong capability check for a plugin system. The loader received a plugin class and needed to ask whether it supported an optional class-level feature. I searched the ordinary class object for that selector, got NULL, and disabled a feature the plugin actually implemented. […]

Objective-C
Application Scenarios of the Three Stages of Message Forwarding

By Seren  |  15 Sep, 2026
Leave a comment

I used to think Objective-C message forwarding was mainly something to study for interviews. That changed during a checkout-module migration. We had an old analytics selector, a receipt exporter hidden behind a compatibility object, and two components that both needed an order-completion callback. All three problems involved a message the receiving object did not implement, […]