init?(plistRepresentation : AnyObject){
switch plistRepresentation{
case "viewing":
self = .viewing
}
}
The above code generates "Expression pattern of type 'String' cannot match values of type 'AnyObject'" error. But the moment I add "as Sttring"
init?(plistRepresentation : AnyObject){
switch plistRepresentation{
case "viewing" as String:
self = .viewing
}
}
the error goes away.. Can anyone explains to me how this works? It looks kinda confusing to me.
Thanks