Unlike Objective-C, Swift has no preprocessor, so is there still a way to manually deprecate members of a class?
I am looking for something similar to this:
-(id)method __deprecated;
Unlike Objective-C, Swift has no preprocessor, so is there still a way to manually deprecate members of a class?
I am looking for something similar to this:
-(id)method __deprecated;
Starting Swift 3 and Swift 4, the version number is optional. You can now simply type:
Or if you want a message go along with it:
You can use the Available tag, for example :
Where * is the platform (iOS, iOSApplicationExtension, macOS, watchOS, tvOS, * for all, etc.).
You can also specify the version of the platform from which it was
introduced
,deprecated
,obsoleted
,renamed
, and amessage
:If your project targets multiple platforms, you can use several tags like so :
More details in the Swift documentation.
You can use this to auto-fix you entrys with your new func
Instead of * you can use swift , for the swift Version number.
Deprecated functions generate warnings but can still be called. (Warning)
Obsolete functions stop it from being called entirely. (Error)
or use other Options like iOS, macOS, watchOS, tvOS ...