How to recursively fetch data via Alamofire for a tree like structure? [closed]










4















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?










share|improve this question















closed as too broad by Ron Maupin, Cristik, Billal Begueradj, stealthyninja, Vivek Mishra Nov 14 '18 at 6:41


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


















  • Do you need to know which generation the person is in, and if so, is that data returned in the API or do you need to figure that out yourself?

    – AdamPro13
    Nov 14 '18 at 4:26











  • hey @AdamPro13, no I don't need to know the generation, just need to iteratively fetch the data for each person starting with the first which will return info about the next 2 generations as array's for that person

    – King David
    Nov 14 '18 at 4:30












  • Edited the question, although I disagree that my question was worded 'too broad' to be put on hold.

    – King David
    Nov 14 '18 at 7:21















4















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?










share|improve this question















closed as too broad by Ron Maupin, Cristik, Billal Begueradj, stealthyninja, Vivek Mishra Nov 14 '18 at 6:41


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


















  • Do you need to know which generation the person is in, and if so, is that data returned in the API or do you need to figure that out yourself?

    – AdamPro13
    Nov 14 '18 at 4:26











  • hey @AdamPro13, no I don't need to know the generation, just need to iteratively fetch the data for each person starting with the first which will return info about the next 2 generations as array's for that person

    – King David
    Nov 14 '18 at 4:30












  • Edited the question, although I disagree that my question was worded 'too broad' to be put on hold.

    – King David
    Nov 14 '18 at 7:21













4












4








4








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?










share|improve this question
















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?







ios swift networking alamofire






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 7:20







King David

















asked Nov 14 '18 at 3:49









King DavidKing David

6619




6619




closed as too broad by Ron Maupin, Cristik, Billal Begueradj, stealthyninja, Vivek Mishra Nov 14 '18 at 6:41


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as too broad by Ron Maupin, Cristik, Billal Begueradj, stealthyninja, Vivek Mishra Nov 14 '18 at 6:41


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • Do you need to know which generation the person is in, and if so, is that data returned in the API or do you need to figure that out yourself?

    – AdamPro13
    Nov 14 '18 at 4:26











  • hey @AdamPro13, no I don't need to know the generation, just need to iteratively fetch the data for each person starting with the first which will return info about the next 2 generations as array's for that person

    – King David
    Nov 14 '18 at 4:30












  • Edited the question, although I disagree that my question was worded 'too broad' to be put on hold.

    – King David
    Nov 14 '18 at 7:21

















  • Do you need to know which generation the person is in, and if so, is that data returned in the API or do you need to figure that out yourself?

    – AdamPro13
    Nov 14 '18 at 4:26











  • hey @AdamPro13, no I don't need to know the generation, just need to iteratively fetch the data for each person starting with the first which will return info about the next 2 generations as array's for that person

    – King David
    Nov 14 '18 at 4:30












  • Edited the question, although I disagree that my question was worded 'too broad' to be put on hold.

    – King David
    Nov 14 '18 at 7:21
















Do you need to know which generation the person is in, and if so, is that data returned in the API or do you need to figure that out yourself?

– AdamPro13
Nov 14 '18 at 4:26





Do you need to know which generation the person is in, and if so, is that data returned in the API or do you need to figure that out yourself?

– AdamPro13
Nov 14 '18 at 4:26













hey @AdamPro13, no I don't need to know the generation, just need to iteratively fetch the data for each person starting with the first which will return info about the next 2 generations as array's for that person

– King David
Nov 14 '18 at 4:30






hey @AdamPro13, no I don't need to know the generation, just need to iteratively fetch the data for each person starting with the first which will return info about the next 2 generations as array's for that person

– King David
Nov 14 '18 at 4:30














Edited the question, although I disagree that my question was worded 'too broad' to be put on hold.

– King David
Nov 14 '18 at 7:21





Edited the question, although I disagree that my question was worded 'too broad' to be put on hold.

– King David
Nov 14 '18 at 7:21












1 Answer
1






active

oldest

votes


















0














Hi i am not going to solve your problem but have an idea to follow this



first of all refer the trie data structure https://www.raywenderlich.com/892-swift-algorithm-club-swift-trie-data-structure



Step 1: Create your simple method for request and response of alamofire for ex. callAPI()



Step 2: in above link there is add method where you call a method of callAPI() and add response array one by one using add.



this is just an approch. you may find a simpler way.




There is once contain method also which helps you to find your subtree
data.







share|improve this answer





























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Hi i am not going to solve your problem but have an idea to follow this



    first of all refer the trie data structure https://www.raywenderlich.com/892-swift-algorithm-club-swift-trie-data-structure



    Step 1: Create your simple method for request and response of alamofire for ex. callAPI()



    Step 2: in above link there is add method where you call a method of callAPI() and add response array one by one using add.



    this is just an approch. you may find a simpler way.




    There is once contain method also which helps you to find your subtree
    data.







    share|improve this answer



























      0














      Hi i am not going to solve your problem but have an idea to follow this



      first of all refer the trie data structure https://www.raywenderlich.com/892-swift-algorithm-club-swift-trie-data-structure



      Step 1: Create your simple method for request and response of alamofire for ex. callAPI()



      Step 2: in above link there is add method where you call a method of callAPI() and add response array one by one using add.



      this is just an approch. you may find a simpler way.




      There is once contain method also which helps you to find your subtree
      data.







      share|improve this answer

























        0












        0








        0







        Hi i am not going to solve your problem but have an idea to follow this



        first of all refer the trie data structure https://www.raywenderlich.com/892-swift-algorithm-club-swift-trie-data-structure



        Step 1: Create your simple method for request and response of alamofire for ex. callAPI()



        Step 2: in above link there is add method where you call a method of callAPI() and add response array one by one using add.



        this is just an approch. you may find a simpler way.




        There is once contain method also which helps you to find your subtree
        data.







        share|improve this answer













        Hi i am not going to solve your problem but have an idea to follow this



        first of all refer the trie data structure https://www.raywenderlich.com/892-swift-algorithm-club-swift-trie-data-structure



        Step 1: Create your simple method for request and response of alamofire for ex. callAPI()



        Step 2: in above link there is add method where you call a method of callAPI() and add response array one by one using add.



        this is just an approch. you may find a simpler way.




        There is once contain method also which helps you to find your subtree
        data.








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 14 '18 at 6:17









        PushpPushp

        325212




        325212















            Popular posts from this blog

            Use pre created SQLite database for Android project in kotlin

            Darth Vader #20

            Ondo