Custom Navigation For Compose Multiplatform: No External Dependencies! Android, iOS, Desktop

Поделиться
HTML-код
  • Опубликовано: 5 окт 2024

Комментарии • 18

  • @vengateshm2122
    @vengateshm2122 4 месяца назад +2

    Great content. While watching and implementing can understand how the compose navigation library written for android.

  • @frank4pickerson
    @frank4pickerson 4 месяца назад +3

    Wow! Great video. I use Avenger for common navigation. I didn't know what you shared is supported.

    • @MaximumDevelopment
      @MaximumDevelopment  4 месяца назад +1

      Thank you! It's a great time to be a multiplatform developer. There's so many excellent options available to us.

    • @frank4pickerson
      @frank4pickerson 4 месяца назад

      @@MaximumDevelopment yes, love how clear you are in your explanation. So crystal clear!

  • @MuhammadBilal-oo4mf
    @MuhammadBilal-oo4mf 2 месяца назад +1

    Great Video Sir 💯

  • @chueypickle
    @chueypickle 4 месяца назад +3

    Another great video. Thank you

  • @Noor_alden
    @Noor_alden Месяц назад +1

    nice , and great content,❤

  • @michaeli5113
    @michaeli5113 3 месяца назад +2

    what happens when you got 50 screens? we list them all in the App component?

    • @MaximumDevelopment
      @MaximumDevelopment  3 месяца назад +2

      Great question! This could warrant its own video but here are my thoughts.
      For starters, we could implement our custom nav graph in its own composable, and pass our state into it. This would clean up our App component, but we would still have to deal with a large, unwieldy list of screens elsewhere. We actually have this same problem with most navigation libraries.
      Going beyond this, we could implement a series of nested nav graphs, breaking up our monolithic graph into smaller chunks (where navigation from certain screens would branch into different graphs).
      This is just one possible solution. If it were my project, I would also consider how many standalone screens could be reduced to sub-screens (removing them from the graph, and handling their visibility within their parent composable).
      As always, there could be many solutions to this, with differing pros and cons. I’m curious how you would approach solving this.
      Thank you for watching, and for your thought provoking question!

  • @CptDuck
    @CptDuck 2 месяца назад +1

    Hello, simple good video, i have a question. How can you handling backpressed in this KMP? Like onbackpressed or something.

    • @MaximumDevelopment
      @MaximumDevelopment  2 месяца назад +1

      Great question! To handle a platform specific forms of navigation (like android back navigation, or iOS gestures) you will need platform specific implementations. These implementations can be used in our shared code with KMP's "expect" and "actual" approach.
      I haven't made any videos on expect and actual yet, but there's a lot of good information about it here:
      kotlinlang.org/docs/multiplatform-expect-actual.html

    • @CptDuck
      @CptDuck 2 месяца назад

      @@MaximumDevelopment oh right! Thank you for the info. I will check it out.

    • @CptDuck
      @CptDuck 2 месяца назад

      @@MaximumDevelopment oh one more thing. Can i just use navCrontroller.popBackStack instead of handling the backpress right? like for example for splash screen.

    • @MaximumDevelopment
      @MaximumDevelopment  2 месяца назад

      If I understand your question correctly, yes you can. You can use the navController in your code without any need for user input. For instance, you could have the app start on a splash screen (with the home screen in the back stack), and use a coroutine to navigate back to the home page after a brief delay. There's a lot of creative ways you could approach this.