2017-01-06 3 views
0

ソースコードファイルのセクションをハイライト表示する方法を探しています。チームの全員がすぐに読んでいることを知ります 廃止予定のコード。Xcode:すぐに廃止予定のソースコードの部分をハイライトしたい

#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 

多分これを行うことができXcodeの拡張機能やプラグインがあります。たとえば

、私はこのような何かを見つけるだろう期待していましたか?

私は時々、これらの他のツールを使用しますが、彼らは不十分である

#warning 
//TODO 
//FIXME 
#pragma mark 
#pragma - 
#pragma GCC poison 

時々私はこれまでのところ、これを行うように行く:

// !!!! 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 !!!! 

答えて

0

なぜ@available属性を使用しない:

// you'll get a deprecation warning here. 
@available(iOS, deprecated: 10.2, message: "ancient") 
typedef packed struct { 
    .... 
} 

Obj-Cの場合はうまくいきませんが、スウィフトは間違いなくuld。それは創造的な取得することも可能です:あなたは二つのアイテムを持っているでしょうので、下に

#if DEBUG 
@available(*, deprecated, message: "Use newer instead") 
let dep = "deprecated" 
#else 
@available(*, deprecated, message: "Use newer instead") 
let `self` = "deprecated" 
@available(*, deprecated, message: "Use newer instead") 
let `DEP` = "deprecated" 
@available(*, deprecated, message: "Use newer instead") 
let Optional = "deprecated" 
#endif 

を非推奨:

それはチームのみんなを困らせるだろうので、私は本当にこの場合、コンパイラの警告を生成したくないよ
kSTRING_CONSTANT = "123" 

print("123", obtain(self: "123")) 

print(DEP) // deprecated 
print(self) // deprecated 
print(kSTRING_CONSTANT) 
+0

。私はちょうどXcodeのコードを違う色にして、読者が読んでいるコードが非難されていることを認識しておいてほしい。 –

関連する問題