From availability.h:

 * API_TO_BE_DEPRECATED is used as a version number in API that will be deprecated 
 * in an upcoming release. This soft deprecation is an intermediate step before formal 
 * deprecation to notify developers about the API before compiler warnings are generated.
 * You can find all places in your code that use soft deprecated API by redefining the 
 * value of this macro to your current minimum deployment target, for example:
 * (macOS)
 *   clang -DAPI_TO_BE_DEPRECATED=10.12 <other compiler flags>
 * (iOS)
 *   clang -DAPI_TO_BE_DEPRECATED=11.0 <other compiler flags>
#define API_TO_BE_DEPRECATED 100000

Is there a way to do the redefinition when importing an ObjC framework into Swift?

Yes, using the -Xcc option. In this case -Xcc -DAPI_TO_BE_DEPRECATED=11.0 to follow the example in the documentation above.

I used this in my package manifest by adding the following to one of my targets:

swiftSettings: [.unsafeFlags(["-Xcc", "-DAPI_TO_BE_DEPRECATED=15.0"], nil)]
Terms of Service

Privacy Policy

Cookie Policy