简体   繁体   中英

Differentiate between iOS and macCatalyst in xcconfig file

In an xcconfig file it's possible to use sdk and arch specifiers. For example:

BUILD_SETTING_NAME[sdk=sdk] = value for specified sdk
BUILD_SETTING_NAME[arch=architecture] = value for specified architecture

How can I use this to use a different value when building for macCatalyst ("UIKit for Mac")?

OK, it turns out to be easier than I thought. You can simply do this in your xcconfig file:

SOME_PLATFORM_DEPENDENT_VALUE = "use this on iOS";
SOME_PLATFORM_DEPENDENT_VALUE[sdk=macosx*] = "use this on macOS including macCatalyst";

On the first line you set the value for all platforms. On the second line you set the value for a specific SDK. The specific value takes precedence over the "general" value.

That's it! You can learn more about these different options in this great NSHipster article .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM