title: Swift Decoding Plist Dictionary of Dictionaries
body: <p>I'd like to use a property list decoder to decode a binary plist of dictionaries</p>
  
  <p><a href="https://i.stack.imgur.com/CIwWu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CIwWu.png" alt="Dictionary"></a></p>
  
  <p>Object that makes dictionary:</p>
  
  <pre><code>struct ZipCode: Codable {
  
      var zipCode: String
      var city: String
      let state: String
      let latitude: String
      let longitude: String
      let timezone: String
      let daylightSavingsFlag: String
      let geopoint: String
  
      enum CodingKeys: String, CodingKey {
          case zipCode = "Zip"
          case city = "City"
          case state = "State"
          case latitude = "Latitude"
          case longitude = "Longitude"
          case timezone = "Timezone"
          case daylightSavingsFlag = "Daylight savings time flag"
          case geopoint = "geopoint"
      }   
  }
  </code></pre>
  
  <p>Wrapper object:</p>
  
  <pre><code>struct ZipCodeList: Codable {
  
      var zipCodes: [String:ZipCode]
  
  }
  </code></pre>
  
  <p>Me trying to read it in which results in nil zipCodelist:</p>
  
  <pre><code>do {
             let path        = Bundle.main.path(forResource: "ZipCodes", ofType: "plist")
             let binary         = FileManager.default.contents(atPath: path!)
             let zipCodes = try? PropertyListDecoder().decode(ZipCodeList.self, from: binary!)
             print("Hi")
      } catch {
  
  }
  </code></pre>