I\'m using Swift 2 and using WeakContainer as a way to store a set of weak objects, much like NSHashTable.weakObjectsHashTable()
NSHashTable.weakObjectsHashTable()
struct WeakCont
If your Protocol can be marked as @obj then you can use code below
protocol Observerable { associatedtype P : AnyObject var delegates: NSHashTable { get } } @objc protocol MyProtocol { func someFunc() } class SomeClass : Observerable { var delegates = NSHashTable.weakObjects() }
{ get } } @objc protocol MyProtocol { func someFunc() } class SomeClass : Observerable { var delegates = NSHashTable.weakObjects() }