ER: ability to annotate methods/properties declared outside my module

Originator:davedelong
Number:rdar://39242857 Date Originated:6 April 2018
Status:open Resolved:
Product:Developer Tools Product Version:
Classification:Enhancement Request Reproducible:N/A
 
I want the ability to annotate methods and properties declared outside my module.

For example, let's say that I have some custom tooling and API related to providing images and colors to my app. This means I do *not* want parts of my app to be able to invoke `+[UIImage imageNamed:]` directly, because it would bypass my mechanism. (Maybe my mechanism uses that under the hood, but provides an abstraction on top of that)

I would want to somehow mark `+[UIImage imageNamed:]` as "unavailable" or "deprecated" or "replaced" so that anyone who *forgets* that the abstraction exists would get a nice compiler hint reminding them to not use the +imageNamed: method.

The same holds true for UIColor: instead of using .green or +colorWithRed:green:blue:alpha:, I provide a "Theme" object that defines contextual properties with semantically-appropriate names like "errorColor" or whatever. In this case I want to deprecate the UIColor initializers.

This extends to LOTS of other things that are all of the form "don't use that; use this instead".

Comments


Please note: 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!