title: Converting NSArray to Array in Swift produces nil to the Array Values
body: <p>I came into something I would assume is an easy enough problem but somehow I can't think of any way to solve it. It's simply converting an NSArray to an Array, and I think I've done a good job here with this code:</p>
  
  <pre><code>func getTrainingSubCategories(completion: @escaping(Result&lt;[TrainingSubCategory], GetError&gt;) -&gt; Void){
      let dataTask = URLSession.shared.dataTask(with: resourceURL){data, _, _ in
          guard let jsonData = data else {
              completion(.failure(.trainingCategoriesNoDataAvailable))
              return
          }
          do{
              let parsedData = try JSONSerialization.jsonObject(with: jsonData) as! [String: Any]
              for (key, value) in parsedData {
                  if key == "categories" {
                      if let categoriesDictionary: [[String: Any]] = value as? [[String: Any]]{
                          for categoryDictionary in categoriesDictionary{
                              for (key, value) in categoryDictionary{
                                  if key == "sub_categories" {
                                      print("1st Type =&gt; \(type(of: value)) Value =&gt; \(value)")
                                      print("2nd Type =&gt; \(type(of: value as? Array&lt;TrainingSubCategory&gt;)) Value =&gt; \(value as? Array&lt;TrainingSubCategory&gt;)")
  //                                        guard let subCategoryValue = value as? Array&lt;TrainingSubCategory&gt; else{
  //                                            fatalError("Error in casting value to array of trainingsubcategory")
  //                                        }
                                  }
                              }
                          }
                      }
                  }
              }
          }catch {
              completion(.failure(.trainingSubCategoriesCannotProcessData))
          }
  
      }
      dataTask.resume()
  }
  </code></pre>
  
  <p>but the console would log otherwise:</p>
  
  <pre><code>1st Value =&gt; (
          {
          "category_id" = 1;
          "company_id" = 50;
          "created_at" = "2019-11-07 00:58:37";
          "deleted_at" = "&lt;null&gt;";
          id = 1;
          name = Advertisement;
          "updated_at" = "2019-11-07 00:58:37";
      },
          {
          "category_id" = 1;
          "company_id" = 50;
          "created_at" = "&lt;null&gt;";
          "deleted_at" = "&lt;null&gt;";
          id = 3;
          name = Sales;
          "updated_at" = "2019-11-10 23:28:30";
      }
  )
  2nd Value =&gt; nil
  1st Value =&gt; (
          {
          "category_id" = 2;
          "company_id" = 50;
          "created_at" = "2019-11-07 19:58:07";
          "deleted_at" = "&lt;null&gt;";
          id = 6;
          name = Inventory;
          "updated_at" = "2019-11-07 19:58:07";
      }
  )
  2nd Value =&gt; nil
  1st Value =&gt; (
          {
          "category_id" = 3;
          "company_id" = 50;
          "created_at" = "2019-11-10 21:24:22";
          "deleted_at" = "&lt;null&gt;";
          id = 9;
          name = "Human Resource";
          "updated_at" = "2019-11-10 21:24:22";
      }
  )
  2nd Value =&gt; nil
  </code></pre>
  
  <p>Am I missing something here? I'm quite new to Swift so I don't actually have much of a guess myself. </p>