Skip to content

Instantly share code, notes, and snippets.

@ezura
Last active June 1, 2017 15:10
Show Gist options
  • Select an option

  • Save ezura/b653a5c5d8724399c726df2ff70320f0 to your computer and use it in GitHub Desktop.

Select an option

Save ezura/b653a5c5d8724399c726df2ff70320f0 to your computer and use it in GitHub Desktop.
意外とありな気がしてきた( 'ω') 全文: https://gist.github.com/ezura/dbb249c5663e97985f49483e6bbac2e5 #swift #CodePiece
protocol P {
associatedtype PermissionMode: Permission = Default
func f() -> String // これを差し替える
}
extension P { /* 略 */ }
extension P where Self.PermissionMode == Strict { /* 略 */ }
struct A: P {}
struct B: P {
typealias PermissionMode = Strict
}
A().callF() // "default callF() - default f() - default v"
B().callF() // "default callF() - Self.PermissionMode == Strict f() - default v"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment