title: Swift filter with condition
body: <p>I'm creating a filter to filter an Array of vehicles. I'm filtering according to price, performance and, optionally, to gearing type.</p>
  
  <pre><code>func filterCarSpecifications(among carSpecifications: [CarSpecification]) -&gt; [CarSpecification] {
  
      let filteredCars = carSpecifications.filter {
  
          let performance = $0.car.ps ?? 0.0
  
          return $0.pricing.price &gt;= IoC.filterDataService.selectedMinPrice.rounded(.down)
              &amp;&amp; $0.pricing.price &lt;= IoC.filterDataService.selectedMaxPrice.rounded(.up)
              &amp;&amp; performance &gt;= IoC.filterDataService.selectedMinPerformance
              &amp;&amp; performance &lt;= IoC.filterDataService.selectedMaxPerformance
      }
  
      if IoC.filterDataService.autoTransmision {
          return filteredCars.filter {
              let transmission: GearingType = .automatic
              return $0.car.gearingType == transmission
          }
      }
  
      return filteredCars
  }
  </code></pre>
  
  <p><code>IoC.filterDataService.autoTransmision</code> is a Bool to check if the user wants to see only automatic vehicles. Is there a way to include this extra value into my original filter?</p>