Closed kimfucious closed 3 years ago
Actually, that's a Dictionary, not an array... 😕
I'm wondering if the response provided by this library is intentionally returning an array, rather than an object.
The type of Track.externalIds
is [String : String]?
, not an array. This matches the structure of the JSON payload.
The term externalIds is somewhat misleading, as it seems to suggest a list of things, rather than a mapping of things
This is the term chosen by Spotify, not me. To me the term, does not specifically imply an array or a mapping. You can easily inspect the declared type of a property in Swift, so I don't understand what the issue is.
Thanks for the clarification, @Peter-Schorn
Frankly, I'm used to working in JS, so the Dictionary threw me. My bad.
I can use the following to get at the data:
track.externalIds?["isrc"]
When I receive a response from a track search, using this wonderful library, I get a response that includes the optional property of
externalIds
, which I'd like to use in the app I'm working on.What I'm seeing is something like this: externalIds:
Optional(["isrc": "GBCBR2100039"])
When I've accessed this property before, via the standard Spotify Web API (not yours), the property is an
ExternalIdObject
, as referenced here, with possible keys of: ean, isrc, & upc.I'm wondering if the response provided by this library is intentionally returning an array, rather than an object.
The term externalIds is somewhat misleading, as it seems to suggest a list of things, rather than a mapping of things, so maybe this is the reason.
Regardless, I can work with the response as is, but I thought I'd bring the above to your attention and see if you have any feedback.
Thanks.