Created
April 12, 2016 11:41
-
-
Save marcomasser/2a6fe10706beffa1ec800e5da389e2f6 to your computer and use it in GitHub Desktop.
This file contains 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
// MARK: Types: | |
protocol EnumType { | |
} | |
protocol MyProtocol { | |
associatedtype SomeType: EnumType | |
func foo(bar: SomeType) | |
} | |
// MARK: Working example: | |
enum MyConformingEnum: EnumType { | |
case Foo | |
case Bar | |
} | |
struct MyWorkingStruct: MyProtocol { | |
func foo(bar: MyConformingEnum) { | |
} | |
} | |
// MARK: Non-working example: | |
enum MyNonConformingEnum { | |
case Foo | |
case Bar | |
} | |
struct MyNonWorkingStruct: MyProtocol { | |
func foo(bar: MyNonConformingEnum) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment