dgold
dgold
Desperately Seeking Swift Pointers ascraeus.org
|
Embed
thomasbibby
thomasbibby

@dgold How homogeneous is the json? If most of the json keys are common, you could use the Decodable protocol that dropped in Swift 4, just make the keys that aren’t always there optional in your class/struct. If the json keys can be completely different, I’d deserialize the json then use a chain of if lets to parse the data into different classes/structs.

|
Embed
In reply to
thomasbibby
thomasbibby

@dgold also, it’s nice to be chatting to someone on here who’s only down the road! I’m happy to look at some code if you need help.

|
Embed
dgold
dgold

@thomasbibby I’m looking at the JSON, and it’s pretty varied. I think I need to insntiate a larger sample size and run some metrics over the data to get a better idea of how different it is. Currently I mostly have extremes.

|
Embed
dgold
dgold

@thomasbibby I must have read that thrice before I copped that you were speaking literally, not figuratively! Welcome welcome welcome. I think that makes two of us 🇮🇪

|
Embed
thomasbibby
thomasbibby

@dgold another option would be to use an array of dictionaries as the data source for your table view, and worry about data structures later when your code feels a bit too messy and you have a better picture of what the api is throwing back at you. Also we have an iOS dev meetup in Limerick every 2 months, you’d be very welcome! www.meetup.com/Limerick-...

|
Embed
thomasbibby
thomasbibby

@dgold and thank you very much for the welcome!

|
Embed