0

In Swift 3 I want to create a dictionary that stores classes of a certain type (i.e. the class of a type, not instances) and also use the class type as the key ...

var viewDelegates = [MyViewDelegate.Type : MyViewDelegate.Type]()

But this gives me Type MyViewDelegate.Type does not conform to protocol Hashable. If I use MyViewDelegate.self instead of MyViewDelegate.Type I get another error: Type of expression is ambiguous without more context.

How can I get this to work?

Hamish
  • 78,605
  • 19
  • 187
  • 280
BadmintonCat
  • 9,416
  • 14
  • 78
  • 129

0 Answers0