title: how to pass a type parameter and compare with object type
body: <p>I an learning the generic portion of Swift, and want to implement something like get a object according to the parameter.</p>
  
  <p>The code seems like:</p>
  
  <pre><code>public func getChartRenderer(classType: anyClass) -&gt; ChartDataRendererBase?
  {
      for renderer in _renderers
      {
          if renderer.dynamicType is anyClass
          {
              return renderer
          }
      }
  
      return nil
  }
  </code></pre>
  
  <p>This is how I call it:</p>
  
  <pre><code>let rendererType = LineChartRenderer.self
  if let lineChartRenderer = renderer.getChartRenderer(rendererType) {
      // do something
  }
  </code></pre>
  
  <p>But I never get it work... I certainly misunderstood something, but I tried google, but still not clear how to do it. Thank in advance</p>