Andrew Bancroft 10/1/2014

Swift Alternative to Objective-C Macros

Read Original

This article discusses replacing Objective-C #define macros with Swift constants (let keyword) to avoid magic values. It covers organizing constants by scope: local to a function, within a class/struct, or globally in a separate file. The author provides examples like storyboard segue identifiers and iOS version checks, emphasizing using constants over enumerations for simpler cases. Targeted at iOS developers transitioning from Objective-C to Swift.

Swift Alternative to Objective-C Macros

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser