Created
February 22, 2018 12:13
-
-
Save SteeweGriffin/061373a99fca2f4727f65fdbb26f458f 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
enum EnumType:Any { | |
case none | |
case firstType(value:String) | |
case secondTypeA(value1:String, value2:Int) | |
case secondTypeB(value1:String, value2:Int) | |
} | |
func checkEnumType(type:EnumType) { | |
switch type { | |
case .none: | |
print("none") | |
case let .firstType(value): | |
print(value) | |
case let .secondTypeA(value1, value2): | |
print(value1) | |
print(value2) | |
case let .secondTypeB(value1, value2): | |
print(value1) | |
print(value2) | |
} | |
} | |
checkEnumType(type: .none) | |
checkEnumType(type: .firstType(value: "pippo")) | |
checkEnumType(type: .secondTypeA(value1: "baudo", value2: 2)) | |
checkEnumType(type: .secondTypeB(value1: "capellone", value2: 3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment