title: How to use .contains for Array of Object in swift 4
body: <pre><code> func addData(){
     if lac_combinedFilterArray[1][0] == true{
          let Lac = realm.objects(LegalAidClinics.self)//.filter("service.lac_service_filter == true")
          for lac in Lac{
              let filteredServices = lac.service.filter("lac_service_filter == true")
              for service in filteredServices{
                  let service_index = filteredServices.index(of: service)
                  if lac.service.contains(filteredServices[service_index!]){
                      if !lac_combined_Array.contains(where: {$0.lac.legal_aid_clinic_id == lac.legal_aid_clinic_id}){
                          lac_combined_Array.append(lac)
                      }
                  }
              }
          }
      if lac_combinedFilterArray[1][1] == true{
          let chapters = realm.objects(IBPChapters.self)
          for chapter in chapters{
              let filteredServices = chapter.service.filter("lac_service_filter == true")
              for service in filteredServices{
                  let service_index = filteredServices.index(of: service)
                  if chapter.service.contains(filteredServices[service_index!]){
                      if !lac_combined_Array.contains(element: Object){
                          lac_combined_Array.append(chapter)
                      }
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>I will append 2 objects in</strong> <code>lac_combined_array</code> <strong>and I want to put a condition</strong> </p>
  
  <pre><code>if lac_combined_array.contains(where: {$0.IBPChapters.ibp_chapter_id == chapter.ibp_chapter_id})
  </code></pre>
  
  <p><strong>and</strong> </p>
  
  <pre><code>if lac_combined_array.contains(where: {$0.LegalAidClinics.legal_aid_clinics_id == lac.legal_aid_clinics_id})
  </code></pre>
  
  <p><strong>How to use</strong>  <code>.contains</code> <strong>in array of object in swift4</strong> </p>