How to perform routing in iOS swift modular application?












4















I am working on a very big app and decided to go with the modular approach where each feature is implemented as a Framework and one feature should not "know" other features.



I decided to use heavily in ReSwift which is a library to build iOS app following the REDUX principles.



I've managed to decouple the global App State from all the Feature state so each feature define its own state and its all managed by the global app state.



The next challenge that I am facing with is Routing / Navigation. I want to be able to route between one view controller which located in Feature1 to another view controller which located in Feature2 (Remember: I want to avoid dependencies between features so Feature1 is not know anything about Feature2).



I know that I can create a central place in my app that can handle all the routes of the application but I wanted to know if there is a way that every Feature will implement its own route. So Feature1 will route to Feature2 without calling to some central implementation.
The motivation here is that every Feature will provide its own resources to the app. So in REDUX principles each feature should provide: State, Reducer, Actions and Router but the challenge here is that features is not depended in other feature.



P.S. for routing I decided to go with ReSwift-Router which is a declarative routing library for ReSwift apps.



Thanks!










share|improve this question



























    4















    I am working on a very big app and decided to go with the modular approach where each feature is implemented as a Framework and one feature should not "know" other features.



    I decided to use heavily in ReSwift which is a library to build iOS app following the REDUX principles.



    I've managed to decouple the global App State from all the Feature state so each feature define its own state and its all managed by the global app state.



    The next challenge that I am facing with is Routing / Navigation. I want to be able to route between one view controller which located in Feature1 to another view controller which located in Feature2 (Remember: I want to avoid dependencies between features so Feature1 is not know anything about Feature2).



    I know that I can create a central place in my app that can handle all the routes of the application but I wanted to know if there is a way that every Feature will implement its own route. So Feature1 will route to Feature2 without calling to some central implementation.
    The motivation here is that every Feature will provide its own resources to the app. So in REDUX principles each feature should provide: State, Reducer, Actions and Router but the challenge here is that features is not depended in other feature.



    P.S. for routing I decided to go with ReSwift-Router which is a declarative routing library for ReSwift apps.



    Thanks!










    share|improve this question

























      4












      4








      4


      1






      I am working on a very big app and decided to go with the modular approach where each feature is implemented as a Framework and one feature should not "know" other features.



      I decided to use heavily in ReSwift which is a library to build iOS app following the REDUX principles.



      I've managed to decouple the global App State from all the Feature state so each feature define its own state and its all managed by the global app state.



      The next challenge that I am facing with is Routing / Navigation. I want to be able to route between one view controller which located in Feature1 to another view controller which located in Feature2 (Remember: I want to avoid dependencies between features so Feature1 is not know anything about Feature2).



      I know that I can create a central place in my app that can handle all the routes of the application but I wanted to know if there is a way that every Feature will implement its own route. So Feature1 will route to Feature2 without calling to some central implementation.
      The motivation here is that every Feature will provide its own resources to the app. So in REDUX principles each feature should provide: State, Reducer, Actions and Router but the challenge here is that features is not depended in other feature.



      P.S. for routing I decided to go with ReSwift-Router which is a declarative routing library for ReSwift apps.



      Thanks!










      share|improve this question














      I am working on a very big app and decided to go with the modular approach where each feature is implemented as a Framework and one feature should not "know" other features.



      I decided to use heavily in ReSwift which is a library to build iOS app following the REDUX principles.



      I've managed to decouple the global App State from all the Feature state so each feature define its own state and its all managed by the global app state.



      The next challenge that I am facing with is Routing / Navigation. I want to be able to route between one view controller which located in Feature1 to another view controller which located in Feature2 (Remember: I want to avoid dependencies between features so Feature1 is not know anything about Feature2).



      I know that I can create a central place in my app that can handle all the routes of the application but I wanted to know if there is a way that every Feature will implement its own route. So Feature1 will route to Feature2 without calling to some central implementation.
      The motivation here is that every Feature will provide its own resources to the app. So in REDUX principles each feature should provide: State, Reducer, Actions and Router but the challenge here is that features is not depended in other feature.



      P.S. for routing I decided to go with ReSwift-Router which is a declarative routing library for ReSwift apps.



      Thanks!







      ios swift redux routing reswift






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 5 '18 at 9:28









      Ran HassidRan Hassid

      2,4151617




      2,4151617
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Looks like we are using a similar architecture pattern, though I decided to define router protocols in each module, all of which are implemented in some central router module. This separates the modules but I'm still able to use a centralized state and dispatch for the whole app.



          After playing with some router libraries, I've made my own state-based solution to better handle VCs hierarchy, still separating state from UI.



          I think it fits your requirements.



          https://github.com/nikans/MonarchRouter



          Monarch Router



          Monarch Router is a declarative routing handler that decouples ViewControllers from each other via Coordinator and Presenters. It fits right in with Redux style State Flow and Reactive frameworks.



          The Coordinator is constructed by declaring a route hierarchy mapped with a URL structure. Presenters abstract UI creation and modification.



          Features:




          • Navigating complex ViewControlles hierarchy and unwinding on path change.

          • Deeplinking to handle Push Notifications, Shortcuts and Universal Links.

          • Switching top-level app sections via changing the window's rootViewController.

          • Navigating forks (tab bar like presenters).

          • Navigating stacks (i.e. navigation controller).

          • Opening and dismissing modals, with their own hierarchy.

          • Parsing and passing route parameters to endpoints.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53151566%2fhow-to-perform-routing-in-ios-swift-modular-application%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Looks like we are using a similar architecture pattern, though I decided to define router protocols in each module, all of which are implemented in some central router module. This separates the modules but I'm still able to use a centralized state and dispatch for the whole app.



            After playing with some router libraries, I've made my own state-based solution to better handle VCs hierarchy, still separating state from UI.



            I think it fits your requirements.



            https://github.com/nikans/MonarchRouter



            Monarch Router



            Monarch Router is a declarative routing handler that decouples ViewControllers from each other via Coordinator and Presenters. It fits right in with Redux style State Flow and Reactive frameworks.



            The Coordinator is constructed by declaring a route hierarchy mapped with a URL structure. Presenters abstract UI creation and modification.



            Features:




            • Navigating complex ViewControlles hierarchy and unwinding on path change.

            • Deeplinking to handle Push Notifications, Shortcuts and Universal Links.

            • Switching top-level app sections via changing the window's rootViewController.

            • Navigating forks (tab bar like presenters).

            • Navigating stacks (i.e. navigation controller).

            • Opening and dismissing modals, with their own hierarchy.

            • Parsing and passing route parameters to endpoints.






            share|improve this answer




























              0














              Looks like we are using a similar architecture pattern, though I decided to define router protocols in each module, all of which are implemented in some central router module. This separates the modules but I'm still able to use a centralized state and dispatch for the whole app.



              After playing with some router libraries, I've made my own state-based solution to better handle VCs hierarchy, still separating state from UI.



              I think it fits your requirements.



              https://github.com/nikans/MonarchRouter



              Monarch Router



              Monarch Router is a declarative routing handler that decouples ViewControllers from each other via Coordinator and Presenters. It fits right in with Redux style State Flow and Reactive frameworks.



              The Coordinator is constructed by declaring a route hierarchy mapped with a URL structure. Presenters abstract UI creation and modification.



              Features:




              • Navigating complex ViewControlles hierarchy and unwinding on path change.

              • Deeplinking to handle Push Notifications, Shortcuts and Universal Links.

              • Switching top-level app sections via changing the window's rootViewController.

              • Navigating forks (tab bar like presenters).

              • Navigating stacks (i.e. navigation controller).

              • Opening and dismissing modals, with their own hierarchy.

              • Parsing and passing route parameters to endpoints.






              share|improve this answer


























                0












                0








                0







                Looks like we are using a similar architecture pattern, though I decided to define router protocols in each module, all of which are implemented in some central router module. This separates the modules but I'm still able to use a centralized state and dispatch for the whole app.



                After playing with some router libraries, I've made my own state-based solution to better handle VCs hierarchy, still separating state from UI.



                I think it fits your requirements.



                https://github.com/nikans/MonarchRouter



                Monarch Router



                Monarch Router is a declarative routing handler that decouples ViewControllers from each other via Coordinator and Presenters. It fits right in with Redux style State Flow and Reactive frameworks.



                The Coordinator is constructed by declaring a route hierarchy mapped with a URL structure. Presenters abstract UI creation and modification.



                Features:




                • Navigating complex ViewControlles hierarchy and unwinding on path change.

                • Deeplinking to handle Push Notifications, Shortcuts and Universal Links.

                • Switching top-level app sections via changing the window's rootViewController.

                • Navigating forks (tab bar like presenters).

                • Navigating stacks (i.e. navigation controller).

                • Opening and dismissing modals, with their own hierarchy.

                • Parsing and passing route parameters to endpoints.






                share|improve this answer













                Looks like we are using a similar architecture pattern, though I decided to define router protocols in each module, all of which are implemented in some central router module. This separates the modules but I'm still able to use a centralized state and dispatch for the whole app.



                After playing with some router libraries, I've made my own state-based solution to better handle VCs hierarchy, still separating state from UI.



                I think it fits your requirements.



                https://github.com/nikans/MonarchRouter



                Monarch Router



                Monarch Router is a declarative routing handler that decouples ViewControllers from each other via Coordinator and Presenters. It fits right in with Redux style State Flow and Reactive frameworks.



                The Coordinator is constructed by declaring a route hierarchy mapped with a URL structure. Presenters abstract UI creation and modification.



                Features:




                • Navigating complex ViewControlles hierarchy and unwinding on path change.

                • Deeplinking to handle Push Notifications, Shortcuts and Universal Links.

                • Switching top-level app sections via changing the window's rootViewController.

                • Navigating forks (tab bar like presenters).

                • Navigating stacks (i.e. navigation controller).

                • Opening and dismissing modals, with their own hierarchy.

                • Parsing and passing route parameters to endpoints.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 24 '18 at 10:37









                nikansnikans

                1,4871926




                1,4871926
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53151566%2fhow-to-perform-routing-in-ios-swift-modular-application%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Ottavio Pratesi

                    Tricia Helfer

                    15 giugno