📂
CMiOSBook
  • CMoney iOS Book
  • Coding 101
    • Value / Reference Type
    • ARC + Retain Cycle
    • 物件之間的溝通方式
  • 工具主題
    • 基本工具篇
    • Git 篇
  • 架構主題
    • MVC
  • CodingStyle主題
    • CodingStyle 規則
      • 專案(Project)
      • 命名(Naming)
      • 程式格式(Format)
      • 註解(Comment)
      • 類別與結構(Classes and Structures)
      • 修飾詞(Modifier)
      • 閉包表達式(Closures)
    • 靜態檢查器
    • 專案基本規定
  • UI主題
    • UIScrollViewDelegate & UITableViewDelegate
  • Charts主題
    • 簡介
    • Lesson1 Chart Setup
    • Lesson2 Chart Data
    • Lesson3 CombinedChartView
    • Lesson4 Renderer
  • Test主題
    • 單元測試的基本概念
    • XCTest-UnitTest
    • XCTest-UITest
  • 學習資源
    • 相關網站
    • 相關會議與社群
    • 計算機考題
Powered by GitBook
On this page

Was this helpful?

  1. CodingStyle主題
  2. CodingStyle 規則

註解(Comment)

全部類別、屬性、方法、列舉,皆用詳細註解(option + cmd + /)

/// 車子
class Car {

    /// 速度
    private var speed = 10
    
    /// 出發
    ///
    /// - Parameters:
    ///   - key: 鑰匙
    ///   - destination: 目的地
    func run(key: String, destination: String){
        // ...
    }
}

平常用於解釋部份 Code 為 //....

func run(key: String, destination: String){
    // Step1: 使用鑰匙發動車子
    start(key: key)
    // Step2: 往目的地前進
    runLoop(destination: destination)
}

標記特定目的的寫法

  • // MARK: - 說明文字

  • // TODO: - 需要做的功能

  • // FIXME: - 待修正的BUG

// MARK: - TransportationDelegate
extension Car: TransportationDelegate {

}
Previous程式格式(Format)Next類別與結構(Classes and Structures)

Last updated 4 years ago

Was this helpful?