Please provide a mechanism for build-time code exclusion based on SDK
||Date Originated:||20-Jun-2016 01:55 PM|
||Product Version:||Version 8.0 beta (8S128d)|
As Apple modifies SDKs, for example to convert attributes that were formerly declared as Objective C methods, into properties, Swift code that accessed those attributes will break.
As long as this kind of change to an SDK can break code, developers who wish to compile the same Swift code across differing SDKs will need some kind of build-time mechanism for excluding the problematic code and including the appropriate code.
#available is not suitable because it generates compiled code for both code paths, and thus causes a build error or warning when buliding against either SDK.
Swift version checking works now, but does not seem to express the actual intent for these exclusions. I'm wary of conditionalizing my code based on Swift version, when it's actually the SDK that contains the variations that concern me.
I'm worried that if I exclude code based on Swift version, that at some point in the future I might face a scenario where the Swift version is in fact not tied unambiguously to the SDK. For example, when Swift becomes stable we may see a transition from one SDK version to another in which the Swift version remains the same. Alternatively, if Apple were to ever decide to support a newer version of Swift on an older SDK, then the exclusion tests for that version of Swift would no longer be reliable.
Please consider providing a build-time mechanism for excluding code *expliciltly* by the platform and version of SDK being considered.
Steps to Reproduce:
Version 8.0 beta (8S128d)
Reports posted here will not necessarily be seen by Apple.
All problems should be submitted at bugreport.apple.com before they are posted here.
Please only post information for Radars that you have filed yourself, and please do
not include Apple confidential information in your posts. Thank you!