Created
August 3, 2018 18:26
-
-
Save pepasflo/2561e4ca7f43e5dc4640c8deab5bf7c6 to your computer and use it in GitHub Desktop.
I can store the type of an object in a dictionary, but I can't seem to match against it in a switch statement. Halp?
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
var dict: Dictionary<String, Any> = ["window.rootViewController": UIViewController.self] | |
switch dict["window.rootViewController"] { | |
// Expression pattern of type 'UIViewController.Type' cannot match values of type 'Any' | |
case .some(UIViewController.self): | |
print("yay!") | |
default: | |
print("boo!") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks @illyabusigin!