Skip to content

Instantly share code, notes, and snippets.

@marcomasser
Created April 12, 2016 11:41
Show Gist options
  • Save marcomasser/2a6fe10706beffa1ec800e5da389e2f6 to your computer and use it in GitHub Desktop.
Save marcomasser/2a6fe10706beffa1ec800e5da389e2f6 to your computer and use it in GitHub Desktop.
// 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