title: how to filter and display the table view and collection view values based on the bool value in my json
body: <p>I have the json list of :</p>
  
  <pre><code> [
       {
  
           "title": "Languages",
           "name_list": [
               {
  
                   "title": "Hindi",
                   "locked": true
               },
               {
                   "title": "Hindi1",
                   "locked": true
               },
               {
                   "title": "Hindi2",
                   "locked": false
               },
               {
                   "title": "Hindi3",
                   "locked": true
               },
               {
                   "title": "Hindi4",
                   "locked": false
               }],
       },
       {
  
           "title": "Subject",
           "name_list": [
               {
                   "title": "Hindi4",
                   "locked": false
               },
               {
                   "title": "Hindi4",
                   "locked": true
               },
               {
                   "title": "Hindi4",
                   "locked": true
               }]
       }    
   ]
  </code></pre>
  
  <p>I am using table view and inside table view i have collection view.</p>
  
  <p>Now in my table view i will show the title .And in my collection view i will show the <code>name_list</code> title on each collection view cell. Now it's working fine.</p>
  
  <p>What i needs is, as you can see in the json, that have many locked =  true and false.</p>
  
  <p>So,  In my table view- which object have less <code>locked == false</code>. that title i needs to show as first. For example.</p>
  
  <p>In my above json, title = subject have only one locked = false, but title = language have 2 locked = false. So in my table view first subject have to display and language.</p>
  
  <p>Same in each collection view, which object have locked = false that needs to display first in my collection view cell.</p>
  
  <p>Any help please.</p>
  
  <p>Here is my code of table view :</p>
  
  <p><code>cellTitleLabel.text = jsonData?["title"] as? String ?? ""</code></p>
  
  <p>in my collection view :</p>
  
  <pre><code>if let gamesList = jsonData?["name_list"]  as? [[String: Any]] {
     let Info = nameList[indexPath.item]
     collectionCell.cellTitleLabel.text = Info["title"] as? String ?? ""
  }
  
     var Info: [String: Any]?{
          didSet {
  
              cellTitleLabel.text = jsonData?["title"] as? String ?? ""
              collectionView.reloadData();
  
              guard let gamesList = jsonData?["name_list"]  as? [[String: Any]] else {
                  return
              }
          }
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/b95NQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b95NQ.jpg" alt="enter image description here"></a></p>