iOSSystemFrameworks注釋標準

如何分工協(xié)作?

  • ①首先從進度.h文件確認文件編號,例如編號fileNumber
  • ②在源庫下會有54個子分支,根據(jù)從上一步中的fileNumber值確定屬于哪一個分支,計算公式為:分支號branchNumber= (fileNumber+49)/50. 然后從54個子分支列表.md獲取要提交的庫鏈接,例如為linkOfNoX.
    這54個分支代表的意義如下圖所示
分工圖.png

如何提交修改?

登錄github
->在上面獲得的linkOfNoX界面下點擊右上角的fork,復(fù)制一份代碼到自己的庫中
->在自己復(fù)制的庫中進行各種修改
->將修改提交到自己復(fù)制的庫中
->在code界面點擊New pull request
->再點擊create new pull request,填寫相關(guān)注釋信息
->此時再點擊create pull request,即可將修改提交到源庫
->剩下的就是在我這邊合并修改了

注釋標準

以UIAlertView.h為例所有括號中的信息皆為說明作用

①緊接頭部原有注釋添加維護者信息,維護者聯(lián)系郵箱,以及該文件對應(yīng)的詳細解釋. 如果發(fā)生維護交接的情況,則將原有的維護者信息移到文件末尾,然后寫上新維護者的信息.


//
//  UIAlertView.h
//  UIKit
//
//  Copyright 2010-2012 Apple Inc. All rights reserved.
//
/*
 * 由XXX維護
 * 聯(lián)系郵箱:XXXX@xxx.xxx
 * 本文件對應(yīng)維護地址:xxxxx(網(wǎng)址,網(wǎng)址中的資料務(wù)求詳盡實用)
 */

#import <Foundation/Foundation.h>
#import <UIKit/UIKitDefines.h>
#import <UIKit/UITextField.h>
#import <UIKit/UIView.h>

②考慮到未來要替換系統(tǒng)原有庫,以及便于合并.注釋要在不影響原有代碼作用的前提下單獨占一行或多行


NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, UIAlertViewStyle) {
    //注釋在不影響原有代碼效果的情況下獨占n行,以避免在合并時發(fā)生沖突
    UIAlertViewStyleDefault = 0,
    /*也可以寫成
     多行注釋形式,總之以安全高效,實用美觀為標準*/
    UIAlertViewStyleSecureTextInput,
    UIAlertViewStylePlainTextInput,
    UIAlertViewStyleLoginAndPasswordInput
} __TVOS_PROHIBITED;

③保留代碼原有格式,例如保留的空行要前后一致


- (id)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER;
- (nullable instancetype) initWithCoder:(nonnull NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;

//保留原有代碼行間隔,比如這里有一行空行,那填上注釋后仍要保留空行
@property(nullable,nonatomic,weak) id /*<UIAlertViewDelegate>*/ delegate;
//保留原有代碼行間隔,比如這里原來沒有空行,那填上注釋后也沒有空行
@property(nonatomic,copy) NSString *title;
@property(nullable,nonatomic,copy) NSString *message;   // secondary explanation text

④原有英文注釋要保留,可是視情況對英文注釋做翻譯,要緊貼代碼


@property(nullable,nonatomic,copy) NSString *message;   // secondary explanation text


// adds a button with the title. returns the index (0 based) of where it was added. buttons are displayed in the order added except for the
// cancel button which will be positioned based on HI requirements. buttons cannot be customized.
//保留系統(tǒng)原有英文注釋;中文注釋可以在翻譯英文注釋基礎(chǔ)上豐富
//中文注釋緊鄰代碼
- (NSInteger)addButtonWithTitle:(nullable NSString *)title;    // returns index of button. 0 based.
- (nullable NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex;
@property(nonatomic,readonly) NSInteger numberOfButtons;

⑤多參數(shù)方法可以借助VVDocument插件來生成標準注釋


// Retrieve a text field at an index
// The field at index 0 will be the first text field (the single field or the login field), the field at index 1 will be the password field. */
/**
 *  多參數(shù)的可以借助vvDocument插件來寫標準注釋
 *
 *  @param textFieldIndex 參數(shù)意義及使用
 *
 *  @return 返回值
 */
- (nullable UITextField *)textFieldAtIndex:(NSInteger)textFieldIndex NS_AVAILABLE_IOS(5_0);


@end

整體注釋效果

//
//  UIAlertView.h
//  UIKit
//
//  Copyright 2010-2012 Apple Inc. All rights reserved.
//
/*
 * 由XXX維護
 * 聯(lián)系郵箱:XXXX@xxx.xxx
 * 本文件對應(yīng)維護地址:xxxxx(網(wǎng)址,網(wǎng)址中的資料務(wù)求詳盡實用)
 */

#import <Foundation/Foundation.h>
#import <UIKit/UIKitDefines.h>
#import <UIKit/UITextField.h>
#import <UIKit/UIView.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, UIAlertViewStyle) {
    //注釋在不影響原有代碼效果的情況下獨占n行,以避免在合并時發(fā)生沖突
    UIAlertViewStyleDefault = 0,
    /*也可以寫成
     多行注釋形式,總之以安全高效,實用美觀為標準*/
    UIAlertViewStyleSecureTextInput,
    UIAlertViewStylePlainTextInput,
    UIAlertViewStyleLoginAndPasswordInput
} __TVOS_PROHIBITED;

@protocol UIAlertViewDelegate;
@class UILabel, UIToolbar, UITabBar, UIWindow, UIBarButtonItem, UIPopoverController;

NS_CLASS_DEPRECATED_IOS(2_0, 9_0, "UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead") __TVOS_PROHIBITED
@interface UIAlertView : UIView

- (instancetype)initWithTitle:(nullable NSString *)title message:(nullable NSString *)message delegate:(nullable id /*<UIAlertViewDelegate>*/)delegate cancelButtonTitle:(nullable NSString *)cancelButtonTitle otherButtonTitles:(nullable NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION NS_EXTENSION_UNAVAILABLE_IOS("Use UIAlertController instead.");

- (id)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER;
- (nullable instancetype) initWithCoder:(nonnull NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;

//保留原有代碼行間隔,比如這里有一行空行,那填上注釋后仍要保留空行
@property(nullable,nonatomic,weak) id /*<UIAlertViewDelegate>*/ delegate;
//保留原有代碼行間隔,比如這里原來沒有空行,那填上注釋后也沒有空行
@property(nonatomic,copy) NSString *title;
@property(nullable,nonatomic,copy) NSString *message;   // secondary explanation text


// adds a button with the title. returns the index (0 based) of where it was added. buttons are displayed in the order added except for the
// cancel button which will be positioned based on HI requirements. buttons cannot be customized.
//保留系統(tǒng)原有英文注釋;中文注釋可以在翻譯英文注釋基礎(chǔ)上豐富
//中文注釋緊鄰代碼
- (NSInteger)addButtonWithTitle:(nullable NSString *)title;    // returns index of button. 0 based.
- (nullable NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex;
@property(nonatomic,readonly) NSInteger numberOfButtons;
@property(nonatomic) NSInteger cancelButtonIndex;      // if the delegate does not implement -alertViewCancel:, we pretend this button was clicked on. default is -1

@property(nonatomic,readonly) NSInteger firstOtherButtonIndex;  // -1 if no otherButtonTitles or initWithTitle:... not used
@property(nonatomic,readonly,getter=isVisible) BOOL visible;

// shows popup alert animated.
- (void)show;

// hides alert sheet or popup. use this method when you need to explicitly dismiss the alert.
// it does not need to be called if the user presses on a button
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated;

// Alert view style - defaults to UIAlertViewStyleDefault
@property(nonatomic,assign) UIAlertViewStyle alertViewStyle NS_AVAILABLE_IOS(5_0);

// Retrieve a text field at an index
// The field at index 0 will be the first text field (the single field or the login field), the field at index 1 will be the password field. */
/**
 *  多參數(shù)的可以借助vvDocument插件來寫標準注釋
 *
 *  @param textFieldIndex 參數(shù)意義及使用
 *
 *  @return 返回值
 */
- (nullable UITextField *)textFieldAtIndex:(NSInteger)textFieldIndex NS_AVAILABLE_IOS(5_0);


@end

__TVOS_PROHIBITED
@protocol UIAlertViewDelegate <NSObject>
@optional

// Called when a button is clicked. The view will be automatically dismissed after this call returns
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex NS_DEPRECATED_IOS(2_0, 9_0);

// Called when we cancel a view (eg. the user clicks the Home button). This is not called when the user clicks the cancel button.
// If not defined in the delegate, we simulate a click in the cancel button
- (void)alertViewCancel:(UIAlertView *)alertView NS_DEPRECATED_IOS(2_0, 9_0);

- (void)willPresentAlertView:(UIAlertView *)alertView NS_DEPRECATED_IOS(2_0, 9_0);  // before animation and showing view
- (void)didPresentAlertView:(UIAlertView *)alertView NS_DEPRECATED_IOS(2_0, 9_0);  // after animation

- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex NS_DEPRECATED_IOS(2_0, 9_0); // before animation and hiding view
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex NS_DEPRECATED_IOS(2_0, 9_0);  // after animation

// Called after edits in any of the default fields added by the style
- (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView NS_DEPRECATED_IOS(2_0, 9_0);

@end

NS_ASSUME_NONNULL_END

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末亡电,一起剝皮案震驚了整個濱河市誉碴,隨后出現(xiàn)的幾起案子排嫌,更是在濱河造成了極大的恐慌芯勘,老刑警劉巖箱靴,帶你破解...
    沈念sama閱讀 216,919評論 6 502
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異荷愕,居然都是意外死亡,警方通過查閱死者的電腦和手機安疗,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,567評論 3 392
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來茂契,“玉大人蝶桶,你說我怎么就攤上這事〉粢保” “怎么了真竖?”我有些...
    開封第一講書人閱讀 163,316評論 0 353
  • 文/不壞的土叔 我叫張陵恢共,是天一觀的道長璧亚。 經(jīng)常有香客問我,道長癣蟋,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,294評論 1 292
  • 正文 為了忘掉前任疯搅,我火速辦了婚禮,結(jié)果婚禮上罪治,老公的妹妹穿的比我還像新娘。我一直安慰自己觉义,他們只是感情好,可當我...
    茶點故事閱讀 67,318評論 6 390
  • 文/花漫 我一把揭開白布霉撵。 她就那樣靜靜地躺著厉碟,像睡著了一般。 火紅的嫁衣襯著肌膚如雪箍鼓。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,245評論 1 299
  • 那天何暮,我揣著相機與錄音铐殃,去河邊找鬼。 笑死富腊,一個胖子當著我的面吹牛,可吹牛的內(nèi)容都是我干的是整。 我是一名探鬼主播民假,決...
    沈念sama閱讀 40,120評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼事秀!你這毒婦竟也來了野舶?” 一聲冷哼從身側(cè)響起易迹,我...
    開封第一講書人閱讀 38,964評論 0 275
  • 序言:老撾萬榮一對情侶失蹤赴蝇,失蹤者是張志新(化名)和其女友劉穎巢掺,沒想到半個月后,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體陆淀,經(jīng)...
    沈念sama閱讀 45,376評論 1 313
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,592評論 2 333
  • 正文 我和宋清朗相戀三年楚堤,在試婚紗的時候發(fā)現(xiàn)自己被綠了含懊。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,764評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡酥筝,死狀恐怖雏门,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情茁影,我是刑警寧澤,帶...
    沈念sama閱讀 35,460評論 5 344
  • 正文 年R本政府宣布步脓,位于F島的核電站浩螺,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏年扩。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 41,070評論 3 327
  • 文/蒙蒙 一相嵌、第九天 我趴在偏房一處隱蔽的房頂上張望况脆。 院中可真熱鬧,春花似錦格了、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,697評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽棠隐。三九已至,卻和暖如春啰扛,著一層夾襖步出監(jiān)牢的瞬間嗡贺,已是汗流浹背隐解。 一陣腳步聲響...
    開封第一講書人閱讀 32,846評論 1 269
  • 我被黑心中介騙來泰國打工煞茫, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留岩臣,地道東北人溜嗜。 一個月前我還...
    沈念sama閱讀 47,819評論 2 370
  • 正文 我出身青樓土全,卻偏偏與公主長得像,于是被迫代替她去往敵國和親裹匙。 傳聞我的和親對象是個殘疾皇子末秃,可洞房花燭夜當晚...
    茶點故事閱讀 44,665評論 2 354

推薦閱讀更多精彩內(nèi)容