Skip to content

Instantly share code, notes, and snippets.

@53ningen
Created May 31, 2015 07:33
Show Gist options
  • Save 53ningen/193c8b9f1ea75eed16f8 to your computer and use it in GitHub Desktop.
Save 53ningen/193c8b9f1ea75eed16f8 to your computer and use it in GitHub Desktop.

Swift コード規約の提案

  • 構造体・クラスは定数プロパティのみを用いる
  • 構造体・クラスのイニシャライザは1つに限定する

基本的なコードスタイル

class Hage {
    public func getHoge(arg : TYPE) -> RETTYPE {
        if value == target { return foo }  // ガード句はワンライナー
        return huga
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment