1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Xcode11でドキュメントコメントが変わった

Last updated at Posted at 2019-12-24

例えばこんな関数があって

func hoge(num: Int) -> Bool {
    return true
}

その関数をカレント行にした状態でドキュメントコメントのショートカット cmd + alt + / をすると

Xcode10.1の場合

/// <#Description#>
///
/// - Parameter num: <#num description#>
/// - Returns: <#return value description#>
func hoge(num: Int) -> Bool {
    return true
}

Xcode11.3の場合

/// <#Description#>
/// - Parameter num: <#num description#>
func hoge(num: Int) -> Bool {
    return true
}

戻り値のコメント欄(Return)がなくなっている!!!

Apple的には不要と見なされたということでしょうか。
関数名にきちんと表れているのが正しい、という話なんでしょうかね。

/// タイトル取得
/// - Returns: タイトル
func getTitle() -> String? {
    return params().title
}

これなら、まあ不要そう。

でも、こういう時は必要な気がするんだけども、これも命名でなんとかすべきなんだろうか。

/// 開始処理
/// - Parameter type: 実行するタイプ
/// - Returns: 実行開始可能かどうか
func startJob(type: JobType) -> Bool {
    if currentJob == .None {
        return true
    } else {
        // 処理が実行中のため、開始しない
        return false
    }
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?