I'm using Alamofire for API requests within my app. A usecase requires that I recursively fetch genealogy data for a family tree such that the initial api call retrieves data for the singular parent (oldest member of the family). The data returned will contain arrays of the next generation of people in the family tree as well as the generation after that & looks like so i.e. parent - [sons] - [grandsons]. I now need to fetch the data for each of the sons & grandsons, so on & so forth, with the data always being nested 2 levels deep until the family tree is exhausted. I'm stuck thinking of ways to implement such a recursive API fetch using Alamofire :( How can I achieve something like this? Any help is welcome.
EDIT: How do I recursively fetch data for a family tree where the response data for each person returns array of people (per generation) of the next two generations?