title: How to filter multiple values from JSON and append the results to the TableView Swift4
body: <p>I am trying to find a solution of how to filter multiple values from a local JSON file at the same time. The values come from UserDefaults (I have a viewController that has some buttons inside, when the button is in an active state, it saves a value to UserDefaults. Which basically means user's interest). Possibly there can be more than one interest. The JSON looks like this:</p>
  
  <pre>
  {
      "article" : [
          {
              "title" : "Basketball",
              "subtitle" : "NBA",
              "interest" : "sports"
          },
          {
              "title" : "Africa",
              "subtitle" : "Sahara",
              "interest" : "travel"
          },
          {
              "title" : "Space",
              "subtitle" : "Satelitte",
              "interest" : "science"
          }
      ]
  }
  </pre>
  
  <p>I need to filter the "interest" key and if it matches the values that are being filtered (comes from UserDefaults), then append those articles to the tableView. This should be done before the tableview loads. The variables from userDefaults:</p>
  
  <pre><code>let sportsInterest = UserDefaults.standard.object(forKey: "Sports") as! String // contains "sports"
  let travelInterest = UserDefaults.standard.object(forKey: "Travel") as! String // contains "travel"
  </code></pre>
  
  <p>The model looks like this: </p>
  
  <pre><code>class Articles: Codable {
      let article: [Article]
  
      init(article: [Article]) {
          self.article = article
      }
  }
  
  class Article: Codable{
      let title: String
      let subtitle: String
      let interest: String
  
      init(title: String, subtitle: String, interest: String) {
          self.title = title
          self.subtitle = subtitle
          self.interest = interest
      }
  }
  </code></pre>
  
  <p>And I am parsing JSON this way: </p>
  
  <pre><code>private var articles = [Article]()
  var fileName: String = "Tasks"
  
  func downloadJSON() {
      let url = Bundle.main.url(forResource: fileName, withExtension: "json")!
  
      do {
          let data = try Data(contentsOf: url)
          let articleList = try JSONDecoder().decode(Articles.self, from: data)
  
          self.articles = articleList.article
  
          DispatchQueue.main.async {
              self.articlesTV.reloadData()
          }
      } catch {
          print("Error occured during Parsing", error)
      }
  }
  </code></pre>