I have something like this:
class Lumber { }
class Fruit { }
enum Size {
case small
case medium
case large
}
let lumberSize = [
Size.small: "2x4",
Size.medium: "4x6",
Size.large: "6x10"
]
let fruitSize = [
Size.small: "grape",
Size.medium: "apple",
Size.large: "watermelon"
]
let size:[AnyObject.Type:Dictionary] = [
Lumber.Type: lumberSize,
Fruit.Type: fruitSize
]
On my size
dictionary definition, I get this real-time error from Xcode Editor:
Type 'AnyObject.Type' does not conform to protocol 'Hashable'
How do I accomplish what I am trying to do with size
? That is, how do I create a dictionary linking types to their specific size dictionaries?
I am thinking that ObjectIdentifier
would help me since it is Hashable
but I do not know how to use it, or if it is the right choice.