The Proposal of Function Back Deployment
It is official! Apple accepted Swift’s SE-0376 offer. Our thanks to Allan Shortlidge as the person behind the idea. And so, the @backDeployed feature is one of the newest and most exciting feature introduced with Swift 5.8 in February 2023.
@backDeployed makes functions, subscripts, and features compatible with older OS versions.
For example, let’s say struct Book is a framework that supports macOS 12. Then, in macOS 13, the developers decided to add an info function to this framework.
Even though the info function is only available on macOS13 and later, adding the @backDeployed attribute to the info function will allow the framework author to serve the minimum distribution target to apps with older macOS versions.
Swift will make some optimizations to detect if the minimum deployment target in our app requires it to execute an older version of this functionality. If so, it will create a fallback version, otherwise it will optimize the code while keeping the original.
If you want to know more about this proposal, you can check it out here:
Apple has not yet shared detailed information about this feature.
For now, we don’t know which features will be able to support this; Apple will decide.
We look forward to hearing more details about @backDeployed. :)