Last active
June 1, 2017 15:10
-
-
Save ezura/b653a5c5d8724399c726df2ff70320f0 to your computer and use it in GitHub Desktop.
意外とありな気がしてきた( 'ω')
全文: https://gist.github.com/ezura/dbb249c5663e97985f49483e6bbac2e5 #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
| 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