Skip to content

Instantly share code, notes, and snippets.

@bartjacobs
Created December 25, 2017 16:54
Show Gist options
  • Save bartjacobs/49f68cd32a96e9dfe60e6a7599ce322e to your computer and use it in GitHub Desktop.
Save bartjacobs/49f68cd32a96e9dfe60e6a7599ce322e to your computer and use it in GitHub Desktop.
import Unbox
struct Restaurant: Unboxable {
let features: [Feature]
init(unboxer: Unboxer) throws {
self.features = try unboxer.unbox(key: "features")
}
}
struct Feature: Unboxable {
let name: String
let address: String
init(unboxer: Unboxer) throws {
self.name = try unboxer.unbox(keyPath: "attributes.NAME")
self.address = try unboxer.unbox(keyPath: "attributes.PHYSICALADDRESS")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment