title: How to create generic protocols in Swift?
body: <p>I'd like to create a protocol with a method that takes a generic input and returns a generic value. </p>
  
  <p>This is what I've tried so far, but it produces the syntax error. </p>
  
  <blockquote>
    <p>Use of undeclared identifier T.</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>
  
  <pre><code>protocol ApiMapperProtocol {
      func MapFromSource(T) -&gt; U
  }
  
  class UserMapper: NSObject, ApiMapperProtocol {
      func MapFromSource(data: NSDictionary) -&gt; UserModel {
          var user = UserModel() as UserModel
          var accountsData:NSArray = data["Accounts"] as NSArray     
          return user
      } 
  }
  </code></pre>