Skip to content

Instantly share code, notes, and snippets.

@morozkin
Created May 8, 2017 19:26
Show Gist options
  • Save morozkin/92ac44f2df6a7d93ceee9060ea347720 to your computer and use it in GitHub Desktop.
Save morozkin/92ac44f2df6a7d93ceee9060ea347720 to your computer and use it in GitHub Desktop.
PatternMatching2
struct Foo {
let name: String
}
func ~=(pattern: String, value: Foo) -> Bool {
return pattern == value.name
}
let foo = Foo(name: "foo")
switch foo {
case "foo":
print("Foo")
default:
break
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment