 <p>Add <code>isEqualTo(:)</code> requirement to <code>JABPanelChangeSubscriber</code> protocol</p> <pre><code>public protocol JABPanelChangeSubscriber { func isEqualTo(other: JABPanelChangeSubscriber) -&gt; Bool } </code></pre> <p>Extension to <code>JABPanelChangeSubscriber</code> protocol with <code>Self</code> requirement</p> <pre><code>extension JABPanelChangeSubscriber where Self: Equatable { func isEqualTo(other: JABPanelChangeSubscriber) -&gt; Bool { guard let other = other as? Self else { return false } return self == other } } </code></pre> <blockquote> <p>Remember to make objects conform <code>Equatable</code> protocol too</p> </blockquote> <pre><code>class SomeClass: Equatable {} func == (lhs: SomeClass, rhs: SomeClass) -&gt; Bool { //your code here //you could use `===` operand } struct SomeStruct: Equatable {} func == (lhs: SomeStruct, rhs: SomeStruct) -&gt; Bool { //your code here } </code></pre> <p>Then find the index</p> <pre><code>func indexOf(object: JABPanelChangeSubscriber) -&gt; Int? { return subcribers.indexOf({ $0.isEqualTo(object) }) } </code></pre> <p>If you want to check the existence of an object before adding them to the array</p> <pre><code>func addSubscriber(subscriber: JABPanelChangeSubscriber) { if !subscribers.contains({ $0.isEqualTo(subscriber) }) { subscribers.append(subscriber) } } </code></pre>