Objective-C enums can be string-backed... sort of
Read OriginalThis article examines the use of FourCC (four-character code) constants in Objective-C enums, specifically using AVAudioSessionErrorCode as an example. It explains how multi-character constants like 'msrv' or 'siri' are actually integers derived from ASCII byte values, not true strings. The author details the hex and decimal representations, the 4-character limitation, and practical uses for logging. While noting this technique is less relevant in Swift, the article provides a historical perspective on a clever C programming pattern in Apple's frameworks.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser
Top of the Week
No top articles yet