title: generic parameter could not be inferred swift
body: <p>I have write an Array extension for distinct items</p>
  
  <pre><code>extension Array {
      func distinct&lt;T: Equatable&gt;() -&gt; [T]{
          var unique = [T]()
          for i in self{
              if let item = i as? T {
                  if !unique.contains(item){
                      unique.append(item)
                  }
              }
          }
          return unique
      }
  }
  </code></pre>
  
  <p>And try to call this function like below</p>
  
  <pre><code>let words = ["pen", "Book", "pencile", "paper", "Pin", "Colour Pencile", "Marker"]
  words.distinct()
  </code></pre>
  
  <p>But it give error "generic parameter 'T' could not be inferred swift" </p>