title: How to filter an array of generic type in iOS
body: <p>I have a function to which I am sending an array of objects.
  What I want to do is to filter this array of objects using their values, since the objects may not have common properties like name, age, etc.</p>
  
  <pre><code>func searchVC&lt;T&gt;(_ searchCriteria: String, _ modelArray: [T]) {
    let filteredArrayOfDict = modelArray.filter { $0.value == searchCriteria }
  
  }
  </code></pre>
  
  <p>However this gives me below error :</p>
  
  <pre><code>Value of type 'T' has no member 'value'
  </code></pre>
  
  <p>My model classes are like : </p>
  
  <pre><code>class ABC : Mappable, CustomStringConvertible {
  public private(set) var name : String?
  public private(set) var age : Int?
  public private(set) var abcArray : [ABCModelArray]
  
  required init?(map: Map){
      name = ""
      age = -1
      mapping(map: map)
  }
  
  func mapping(map: Map) {
      name &lt;- map["Name"]
      age &lt;- map["Age"]
  }
  
    public var description: String{
  }
  }
  
  
  class EFG : Mappable, CustomStringConvertible {
     public private(set) var type : String?
     public private(set) var code : Int?
     public private(set) var efgArray : [EFGModelArray]
  
     required init?(map: Map){
         type = ""
         code = -1
         mapping(map: map)
     }
  
     func mapping(map: Map) {
         type &lt;- map["Type"]
         code &lt;- map["Code"]
     }
  
     public var description: String{
   }
  }
  </code></pre>
  
  <p>How can it be achieved?</p>