Having a Set of a specific interface in java is very useful:
HashSet<MyInterface> mySet;
Is it possible to do something similar in Swift?
I tried unsuccessfully the following:
public protocol DialogDelegate : class, Hashable
{
func myFunction()
}
public final class DialogManager: NSObject
{
private var _dialogDelegates: Set<DialogDelegate>
private override init()
{
_dialogDelegates = Set<DialogDelegate>()
super.init();
}
}
I get the compiler error:
Protocol 'DialogDelegate' can only be used as a generic constraint because it has Self or associated type requirements