I have a declaration..
var cabResults = Dictionary<CabType, [CabResult]>()
Now I want to check if the object is present in the dictionary for a particular key.. which can be don by
if self.cabResults[currentCabType] != nil
Now I also want to check if the object returned by self.cabResults[currentCabType]
is of type [CabResult]
How can I get this..?
I would use if let ... as? ...
:
if let cabs = self.cabResults[currentCabType] as? [CabResult] {
// yep
} else {
// nope
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments