title: Determine whether array contains one or more elements of another array in swift
body: <p>I have the following code which returns places near the user's current location</p>
  
  <pre><code>import UIKit
  import GooglePlaces
  import CoreLocation
  
  struct GlobalVariables {
      static var acceptedEstablishments = ["bakery", "bar", "cafe", "food", "meal_takeaway", "meal_delivery", "night_club", "restaurant", "school", "university"]
  }
  
  class ViewController: UIViewController, CLLocationManagerDelegate {
  
      var placesClient: GMSPlacesClient!
      var locationManager: CLLocationManager!
  
      // Add a pair of UILabels in Interface Builder, and connect the outlets to these variables.
      @IBOutlet var nameLabel: UILabel!
      @IBOutlet var addressLabel: UILabel!
  
  
      override func viewDidLoad() {
          super.viewDidLoad()
          placesClient = GMSPlacesClient.shared()
  
          locationManager = CLLocationManager()
          locationManager.delegate = self
          locationManager.requestWhenInUseAuthorization()
      }
  
      func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
          if status == .authorizedWhenInUse {
              locationManager.desiredAccuracy = kCLLocationAccuracyBest
              locationManager.startUpdatingLocation()
          }
      }
  
      // Add a UIButton in Interface Builder, and connect the action to this function.
      @IBAction func getCurrentPlace(_ sender: UIButton) {
  
          placesClient.currentPlace(callback: { (placeLikelihoodList, error) -&gt; Void in
              if let error = error {
                  print("Pick Place error: \(error.localizedDescription)")
                  return
              }
  
              if let placeLikelihoodList = placeLikelihoodList {
                  for likelihood in placeLikelihoodList.likelihoods {
                      let place = likelihood.place
                      // only return places that are relevant to me
                      for placeType in place.types {
                          if (GlobalVariables.acceptedEstablishments.contains(placeType)) {
                              print("Current place name: \(place.name)")
                              print("Place type: \(placeType)")
                          }
                      }
  
                  }
              }
          })
      }
  }
  </code></pre>
  
  <p><code>place.types</code> in my callback function at the bottom returns an array of strings for each place instance, which looks something like this: </p>
  
  <p><code>["health", "point_of_interest", "establishment"]</code></p>
  
  <p>I have a global array of strings which also contains tags such as <code>bakery</code>, <code>bar</code>, etc. </p>
  
  <p>When the user presses a button, the callback function is triggered and returns places based on the nearby location. </p>
  
  <p>The output looks something like this: </p>
  
  <pre><code>Current place name: LOCAL SUPERMARKET
  Place type: food
  Current place name: LOCAL GRILL
  Place type: cafe
  Current place name: LOCAL GRILL
  Place type: food
  Current place name: LOCAL SCHOOL
  Place type: school
  Current place name: LOCAL TAKEAWAY
  Place type: meal_takeaway
  Current place name: LOCAL TAKEAWAY
  Place type: restaurant
  Current place name: LOCAL TAKEAWAY
  Place type: food
  </code></pre>
  
  <p>The same establishment is repeated multiple times because a single establishment has more than one tag associated with it. </p>
  
  <p>For example: </p>
  
  <p>The returned array for <code>place.types</code> for <code>LOCAL TAKEAWAY</code> is: <code>["meal_takeaway", "restaurant", "food"]</code></p>
  
  <p>and because my <code>GlobalVariables.acceptedEstablishments</code> array contains all three of those strings, the <code>print</code> command will be executed three times.</p>
  
  <p>How can this code be amended so that it only displays the establishment once, if the <code>place.types</code> array contains one or more of the matching strings? I can't seem to get my head around a solution. </p>