I'm searching for a method of highlighting sections of a source code file so that everyone on the team knows immediately that they are reading deprecated code.
For example, I was hoping I would find something like this:
#pragma clang diagnostic push
#pragma clang diagnostic use-italic-font
- (void) myDeprecatedFunction
{
... 300 lines of deprecated function body
... that will be removed soon
}
#pragma clang diagnostic pop
Maybe there is an Xcode extension or plugin that could do this?
I use these other tools sometimes, but they are insufficient:
#warning
//TODO
//FIXME
#pragma mark
#pragma -
#pragma GCC poison
Sometimes I go so far as doing this:
// !!!! DEPRECATED VERSION OF STRUCT !!!!
typedef packed struct
{
UInt8 mParamID; // !!!! DEPRECATED VERSION OF STRUCT !!!!
SInt8 mDmxChannelOffset; // !!!! DEPRECATED VERSION OF STRUCT !!!!
UInt16 mEncoderMinVal; // !!!! DEPRECATED VERSION OF STRUCT !!!!
UInt16 mEncoderMaxVal; // !!!! DEPRECATED VERSION OF STRUCT !!!!
UInt16 mHomeVal; // !!!! DEPRECATED VERSION OF STRUCT !!!!
UInt8 mEncoderSensitivity; // !!!! DEPRECATED VERSION OF STRUCT !!!!
UInt8 mParamFlags; // !!!! DEPRECATED VERSION OF STRUCT !!!!
UInt8 mExtraCode; // !!!! DEPRECATED VERSION OF STRUCT !!!!
UInt8 mExtraValue; // !!!! DEPRECATED VERSION OF STRUCT !!!!
SInt8 mExtraDMXAddressOffset; // !!!! DEPRECATED VERSION OF STRUCT !!!!
UInt8 mReserved; // !!!! DEPRECATED VERSION OF STRUCT !!!!
UInt8 mMoreDataFlags; // !!!! DEPRECATED VERSION OF STRUCT !!!!
// Dynamic state
SInt8 mDynamicDmxChannelOffset; // !!!! DEPRECATED VERSION OF STRUCT !!!!
SInt16 mDynamicEncoderMinVal; // !!!! DEPRECATED VERSION OF STRUCT !!!!
SInt16 mDynamicEncoderMaxVal; // !!!! DEPRECATED VERSION OF STRUCT !!!!
SInt16 mDynamicHomeVal; // !!!! DEPRECATED VERSION OF STRUCT !!!!
UInt8 mDynamicEncoderSensitivity; // !!!! DEPRECATED VERSION OF STRUCT !!!!
UInt8 mDynamicFlags; // !!!! DEPRECATED VERSION OF STRUCT !!!!
} ParamInfo_Vers3; // !!!! DEPRECATED VERSION OF STRUCT !!!!
Why not use the
@available
attribute:I'm not sure if it works for
Obj-C
, but for Swift it definitely should. It's also possible to get creative:So below you would have two items deprecated: