title: Can swift generics be used inside class with generics
body: <p>I have a protocol call <code>Decodable</code>:</p>
  
  <pre><code>public protocol Decodable {
      typealias DecodedType = Self
      static func decode(e: Extractor) -&gt; DecodedType?
  }
  </code></pre>
  
  <p>I have a function <code>decode</code>:</p>
  
  <pre><code>public func decode&lt;T: Decodable where T.DecodedType == T&gt;(object: AnyObject) -&gt; T? {
  </code></pre>
  
  <p>Also, I have a class <code>RestApiResponseParser</code></p>
  
  <pre><code>class RestApiResponseParser&lt;T where T:Decodable&gt; {
      private func createServerModels(response: ServerResponse) -&gt; Result&lt;T&gt; {
          var parsingError:NSError?
          let link: T? = decode(response)
          ...
      }
      ...
  }
  </code></pre>
  
  <p>and <code>typealias ServerResponse = [String: AnyObject]</code>
  which I try to call as:</p>
  
  <pre><code>let responseParser = RestApiResponseParser&lt;MyModel&gt;(responseData: inputObject as! NSData)
  let processError = responseParser.processResponseData()
  </code></pre>
  
  <p>Unfortunately, I get compile time error:</p>
  
  <p><a href="https://i.stack.imgur.com/Clgl1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Clgl1.png" alt="enter image description here"></a></p>
  
  <p>Does it mean, I can't use generic function in generic class?</p>