Array of Protocol instances won't work with contains method <p>I have a protocol that I am using to define what makes up the content of a note. A note can have many different content types, so a protocol seemed like the best way to go.</p> <pre><code>public protocol Content { var contentType: String { get } } </code></pre> <p>I then have an implementation of that protocol</p> <pre><code>public class PlainTextContent: Content { public var contentType: String { return "Plain Text" } public var text: String = String() public init(content: String) { self.text = content } } </code></pre> <p>This is a simplified example of the two objects. Next I have a <code>Note</code> class that holds an <code>Array</code> of <code>Content</code> protocol implementations.</p> <pre><code>public class Note { public private(set) var noteContent: [Content] = [] public var title: String = String() public var date: NSDate public init() { self.date = NSDate() } func insertContent(content: Content) -&gt; Bool { if contains(self.noteContent, content) { return false } self.noteContent.append(content) return true } func deleteContent(content: Content) -&gt; Bool { return false } } </code></pre> <p>The problem that I have is that when I do</p> <pre><code>if contains(self.noteContent, content) {} </code></pre> <p>the compiler tells me</p> <blockquote> <p>Note.swift:21:12: Cannot find an overload for 'contains' that accepts an argument list of type '([Content], Content)'</p> </blockquote> <p>I have looked a <a href="http://stackoverflow.com/questions/24102024/how-to-check-if-an-element-is-in-an-array">few examples</a> on <a href="http://stackoverflow.com/questions/28615434/xcode-swift-check-if-array-contains-object">Stackoverflow</a> and I'm doing as they show. Is there an issue with how I am defining my protocol in order for me to use it as an array and the associated global functions?</p> <h2>Edit</h2> <p>I have also tried to make the protocol inherit from <code>Equatable</code>, at which point I get the following compiler error</p> <blockquote> <p>Protocol 'Content' can only be used as a generic constraint because it has Self or associated type requirements</p> </blockquote> <p>I'm a little confused as to how I can perform equality checks against the array of protocols. Is that something that Swift doesn't support? I'm coming from a C# background, so not sure how Swift handles protocols fully.</p>