Skip to content
Discussion options

You must be logged in to vote

Hey @diligiant,

Unfortunately I'm out of town, and I'm only now having the chance to catch up with everything.

If I got this correctly, I think the best solution would be extending items definition like this.

var items: [Media]? {
   self["saveMediaResponse"]["items"].array().compactMap {
      $0.media.optional().flatMap(Media.init)
			?? $0.optional().flatMap(Media.init)
   }
}

(I haven't checked the actual response model, btw, so apologies if it's not 100%: I'm just basing it off your post)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@diligiant
Comment options

@sbertix
Comment options

Answer selected by sbertix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants