I can't seem to get #elifdef
to work in my iOS project. If I do this:
#ifdef X const Foo bar[] = { ... }; #else const Foo bar[] = { ,,, }; #endif
Then the top one (under X) gets highlighted and the bottom one doesn't. If I do this:
#ifdef W const Foo bar[] = { ;;; }; #elifdef X const Foo bar[] = { ... }; #else const Foo bar[] = { ,,, }; #endif
Then the bottom one (under else) gets highlighted and the top two don't. Why? Is there another way I should be doing this? I have three targets and they all use the same m file. However, the constants are a bit different for each target so I separate them this way.
Once the July 31st, 2021 date is reached: No further versions and patches of the Objective-C SDK will be released. All Objective-C SDK download links on the My Workspace ONE portal will be removed or redirected to the Swift SDK download link instead.
Furthermore, Objective-C is a piece of art, creators packed genius solutions and were constantly improving it, so us developers were able to use it at our advantage. There are a lot of indicators telling us there's still a ton of legacy Objective-C code, both from Apple and from other developers, that's still in use.
Objective-C is so pervasive in iOS that it's impossible to completely remove it. Apple continues to maintain libraries written in Objective-C, so we should expect Objective-C to be treated as a (mostly) first class language in iOS. At other companies, legacy code remains.
It won't be deprecated, but it'll move to Florida to enjoy its golden years. It'll spend days running the legacy app with a million lines of code, and its nights sipping margaritas with the OAuth library everyone fears rewriting.
You can simply write:
#elif defined X
Which should be compatible with all ANSI-C compatible compilers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With