Created
January 10, 2017 15:49
-
-
Save es-kumagai/edf258b1b352fb71da33e4a0291924e8 to your computer and use it in GitHub Desktop.
この『プロトコルでtypealiasを使う例』ね。こんなコードを見ながら、プロトコルには型定義をネストできないからプレフィックスをつけざるを得ないけれど…と話していたのでした。 #swift #CodePiece
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 型をプロトコルに入れ子できないので… | |
enum MyProtocolKind { | |
} | |
// 型エイリアスでそれっぽく仕上げる例。 | |
protocol MyProtocol { | |
typealias Kind = MyProtocolKind | |
var kind: Kind { get } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment