Replies: 1 comment
-
Sure it does. All that I suspect you are confusing the types created as the chain is set up with the types that propagate through the chain itself. is the same as The closure is just an argument to
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm trying to wrap my head around the promise concept and I'm having some issue when dealing with HTTP GET requests.
I have a function
fthat calls an HTTP endpoint, decodes some JSON and returns a Swift object after doing some transformations on an intermediate type:rgpin this case is an object containing an array of objects.Now, I need to bolt several other HTTP calls, which should be executed for a subset of
rgpcomponents:As far as I understand,
compactMapdoes not permit chaining other promises withthenbecause it doesn't return aPromiseitself.What's the best way to tackle this situation?
I do not know the subset of object to work with before the second
compactMapends.I tried embedding the
whenlogic in the lattercompactMapbut since it's all async the wrapping closure returns before thewhenends, and to be honest it doesn't look good enough.Beta Was this translation helpful? Give feedback.
All reactions