Type-Safe Navigation with the OFFICIAL Compose Navigation Library

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ธ.ค. 2024

ความคิดเห็น • 276

  • @anandA3b
    @anandA3b 7 หลายเดือนก่อน +79

    Yes. Yes. Yes. Omg. Tears of joy. Really needed a new way!!!!!

  • @sosaucemp3
    @sosaucemp3 7 หลายเดือนก่อน +196

    7:17 He sounds so happy about it 😭

    • @WakeupDev.
      @WakeupDev. 7 หลายเดือนก่อน +16

      yea... I felt that in his voice 😄

    • @farfar5828
      @farfar5828 7 หลายเดือนก่อน +8

      😂😂 I felt that too

    • @KevinMeneses
      @KevinMeneses 7 หลายเดือนก่อน

      X3

    • @BSS_00
      @BSS_00 7 หลายเดือนก่อน +1

      its like every developer after a new good feature

    • @ilyastoletov
      @ilyastoletov 6 หลายเดือนก่อน +2

      Cause this feature reduces hundreds of lines of boilerplate parsing arguments, ensuring they're not null, etc...

  • @annaberkovitch85
    @annaberkovitch85 7 หลายเดือนก่อน +19

    Philipp, I've no words!!!! Thank you for brightening my day! But mostly thank you for the truly TREMENDOUS amount of work you're doing to bring all those updates to us in a manner that's both timely and incredibly clear. Just... Thank you!!!!

  • @ayitinya
    @ayitinya 7 หลายเดือนก่อน +21

    This is actually the best news in android i've heard in a really long while

  • @lindaporsius
    @lindaporsius 7 หลายเดือนก่อน +15

    Could you please make a video about Drawer/BottomNav using this lib? Especially how you would handle the selected-property of a nav-item (and the corresponding icons)

  • @JackCheungShingKit
    @JackCheungShingKit 7 หลายเดือนก่อน +6

    That JSON serialization is how I did before for passing argument.
    Though my approach on serialization & deserialization boilerplate can be ugly.
    Agree that it is a great improvement. I wish they made this available since the beginning.

  • @rishabhsaraswat1928
    @rishabhsaraswat1928 7 หลายเดือนก่อน +20

    4:03 we can clearly see his happiness.

  • @amit470
    @amit470 7 หลายเดือนก่อน +4

    Such a relief, I need this to be in compose stable

  • @magedahmed5981
    @magedahmed5981 7 หลายเดือนก่อน +9

    Finally .. a simple straight routing .. 😊

  • @moheltanani1036
    @moheltanani1036 6 หลายเดือนก่อน +1

    If you were in tears, I'm crying right now hehe. Love it, thanks a lot!

  • @Jessewb786
    @Jessewb786 7 หลายเดือนก่อน +2

    I was using Circuit and it's own navigation, so I've been making use of type-safe screens with painless parcelable arguments for quite a while.
    It's nice to now see this present in the official library.

  • @MatthewSmith-mt3kz
    @MatthewSmith-mt3kz 7 หลายเดือนก่อน +1

    The demo is a pretty simplistic, but a good intro into the new Nav feature. In the real world you'd be getting the screen argument from savedstatehandle. Keep up the good work Phillipp, your videos have saved me hours. Thank you.

  • @Zscor27
    @Zscor27 5 หลายเดือนก่อน

    Thanks for keeping us updated on new stuff. The eco system changes so fast in Android, and there really isn't many youtubers keeping up but atleast we have you :D

  • @worthex_2
    @worthex_2 7 หลายเดือนก่อน +2

    Omg this feels much more satisfying to do nagivation straight with classes now. Beautiful update.

  • @geanbrandao4987
    @geanbrandao4987 7 หลายเดือนก่อน +2

    It's so easy now. Thank you for bringing this content to us! Keep up the great work, hugs from Brazil.

  • @coalacorey
    @coalacorey 7 หลายเดือนก่อน +1

    Finally! As soon as the stable release is out I will implement it.

  • @supadeurali9848
    @supadeurali9848 7 หลายเดือนก่อน +3

    Wow wow wow.... tears in my eyes as well.
    So excited to try this.

  • @vengateshm2122
    @vengateshm2122 7 หลายเดือนก่อน +4

    There was a crash when we try to pass custom type like User(val id: Int, val name:String, val isPremium) in 2.8.0-alpha08 version which is fixed recently in version 2.8.0-beta01.

  • @nanonkay5669
    @nanonkay5669 6 หลายเดือนก่อน +23

    2 reasons why I started and stopped Android dev within a year:
    1. Lack of a package manager that handles all package installations, they're dependencies and versions without having to manually do it every time and manually tweaking package and dependency versions
    2. Navigation between screens
    The second one seems to be solved. If the first one gets solved, I'd be back to Android dev in a heartbeat

    • @deepakbisht4957
      @deepakbisht4957 2 หลายเดือนก่อน

      Native android development is much much better than iOS development.
      If you look at iOS development they don't even follow basic architecture in app development, No DI and no proper guide for modernization and app architecture.
      Even in their Switch UI they have restrictions like you can use this kind of code in ios17 only and other type of library in ios 15 and above like things whereas Compose is backward compatable and you can literally use even in low Android versions but in iOS even for basic recyclable or lazy Hstack or Vstaco you can only use in iOS 14+, if you want to use iOS13 or less you can only use Hstack not it's lazy property even though recycling in vertical and horizontal list is the most basic thing and they are making ios version dependent development packages.
      They just launched SwiftData but the catch is you can use it in iOS17+. Tell me why will you migrate or even think of using their latest library in your production code as it will only work in iOS17 and above???
      You won't even dare to update into latest packages. Whereas Android libraries are always backward compatable, it's not like if they launch Room2.0 then they will say things like it will only work above Android 15 or something...
      Even they pro idea fully fledged app written with latest libraries, look at their "Android now" github repository, it has app modularization, app architecture, case studies and product flavors and even this app production code is in prllay store...
      iOS Apple documentation have no such teams to provides these kind of things, they only have basic single screen app and that's alos without any architecture...
      Native android development is much matured with jetpack libraries and their own source code than many other frameworks at present....
      They even update their github repository actively...

  • @raeesmohit01
    @raeesmohit01 7 หลายเดือนก่อน +1

    It was really a big problem for beginners for me to change the screen and you made it easy now

  • @vit4mint685
    @vit4mint685 7 หลายเดือนก่อน +2

    Just wrapped up a project that used a lot of the old compose navigation. Looking forward to this

  • @Raluca.Lucaci
    @Raluca.Lucaci 2 หลายเดือนก่อน +1

    Philip , thanks a lot for your videos! We followed this sample of navigation and we are struggling with an issue.
    When the user selects an item from the first screen, the detail screen is shown. Pressing the back button returns to the first screen, but the focus is reset. I want to keep the focus in place when returning to the first screen. What could be wrong? Is there a clean and easy way to achieve this? I mention it is a Tv app and we work a lot with focus

  • @yahussainmazloom1
    @yahussainmazloom1 7 หลายเดือนก่อน +1

    Finally some good updates, finally so much relief after this update

  • @TimKaragosian
    @TimKaragosian 7 หลายเดือนก่อน +1

    This looks similar, but even better than Decompose. As always, thanks for sharing these great videos and quality content!

  • @siftoshka
    @siftoshka 7 หลายเดือนก่อน +4

    What if I need this parameters on ViewModel?

  • @quangthaita6084
    @quangthaita6084 7 หลายเดือนก่อน +1

    Thanks who created this, thanks Phillips ❤ That's what we're waiting for

  • @tmjromao
    @tmjromao 7 หลายเดือนก่อน +1

    Thanks for the video. Is the bottom navigation also changing accordingly? What is needed to have screenB with bottom navigation graphs? Thanks.

  • @ASTAppLab
    @ASTAppLab 7 หลายเดือนก่อน +1

    being as Android Native Developer appreciate 👍 you

  • @ilyastoletov
    @ilyastoletov 7 หลายเดือนก่อน +2

    Just use Reimagined Navigation that has a bunch of cool features such as type-safe navigaiton and Parcelable support out of the box. Also community have the Decompose as a multiplatform solution. Both of these libraries are completely driven by community so if you prefer only official libraries it's always OK

    • @deepakbisht4957
      @deepakbisht4957 2 หลายเดือนก่อน

      No one takes the pains of using community libraries in their enterprise projects.
      We create our own solutions.
      Only indie developers or freelancers use these things in small projects or the types of projects they want to deliver as soon as possible.
      For scalable projects, no one takes these kinds of risks to resolve issues with community libraries.
      They either use snippets of them instead of using the entire libraries or the most famous ones with big organization repos, such as Retrofit, Coil, Glide, and so on....

    • @besties-topic
      @besties-topic 20 วันที่ผ่านมา

      ​@@deepakbisht4957 That is the main issue with multiplatform solutions. It's a continuous fight over efficiency in platform independency during a much larger generalized fight over market share between Google and Apple. If you don't want or can't permit the risks one sets up more robust native codebases. Especially consulted governments and companies.

  • @manticomar1146
    @manticomar1146 7 หลายเดือนก่อน +1

    The questino is in my view model how would I use savedStateHandle to extract the parameters?

  • @Mexicanerie
    @Mexicanerie 7 หลายเดือนก่อน +1

    Amazing ! I'm already making a PR on my projec with theses improvments 😁

  • @aiyuayaan
    @aiyuayaan 7 หลายเดือนก่อน

    Thanks @Philipp Lackner, one thing I have to mention is we can't send empty string as value, I am using 2.8.0-beta01.

    • @SunAndMoon-zc9vd
      @SunAndMoon-zc9vd 7 หลายเดือนก่อน

      With "empty string" do you mean:
      1.a text with no characters; like ""
      2. or do you mean undefined
      3. or do you mean null

    • @aiyuayaan
      @aiyuayaan 7 หลายเดือนก่อน

      @@SunAndMoon-zc9vd I mean "" this

  • @Seb01011
    @Seb01011 12 วันที่ผ่านมา

    Hi Philipp, does it work the same with a ScreenC, a route from screenA to C? Does it change anything for the return button? This video is BIG help thanks so much

  • @okeziokezino
    @okeziokezino 7 หลายเดือนก่อน +1

    Philip my guy, this is awesome... love all your work

  • @youNeverThoughtAboutIt
    @youNeverThoughtAboutIt 6 หลายเดือนก่อน +1

    Shouldn't we store those composables for different screens in separate files? Maybe I'm just thinking in old Fragment style though

  • @AntliaRodriguez-d9t
    @AntliaRodriguez-d9t 5 หลายเดือนก่อน

    Uff faltan tutoriales asi en español, gracias a youtube por los subtítulos! Estaba buscando entender esto y solo con tu video pude

  • @MateuszKowol-nu8lr
    @MateuszKowol-nu8lr 7 หลายเดือนก่อน

    Still nice improvement however the main advantage of f.e. voyager is that you do not need to declare the navHost and its all routes. Voyager allows you to just jump from ScreenA to ScreenB without declaring it in your navHost. Google's navigation is still kinda similar to the fragment navgraph but without the childlish arrowing thing.

  • @OwlChillStation
    @OwlChillStation 7 หลายเดือนก่อน +2

    Thanks for the video! So exciting! I have a question, does it automatically work with SavedStateHandle in a ViewModel?

    • @jeonie9682
      @jeonie9682 7 หลายเดือนก่อน

      I did today and worked well. but you should use the method now like "SavedStateHandle.toRoute" not just "savedStateHandle" in a ViewModel.

  • @joatancarlos2704
    @joatancarlos2704 7 หลายเดือนก่อน +1

    Thank you for bringing this content in a very didactic way

  • @YoyoJojo-vi3bt
    @YoyoJojo-vi3bt 17 วันที่ผ่านมา

    Well, if, for example, you want to get screen objects from the DI graph, or some other data from the graph, won't this cause various kinds of problems, as it happens when using Voyager

  • @markocicak4004
    @markocicak4004 2 หลายเดือนก่อน

    It's also working for KMP Compose, but do you know of a way to enable swipe-to-back gesture on iOS which natively works on iOS UINavigationController?

  • @ronalkspdev
    @ronalkspdev 4 หลายเดือนก่อน

    hay un error en el OnRestart cuando la activity se pausa por poca ram y se ejecuta el onRestar manda error de restoring back stack alguien le paso?

  • @resitsahin7787
    @resitsahin7787 7 หลายเดือนก่อน

    Hi Philip, can you make a video about drag and drop of lazy column, i have stuck there. It seems they have recently added this capability.

  • @loklok2003
    @loklok2003 6 หลายเดือนก่อน

    But how can I check the currentDestination using Type-Safe Navigation? For example, I would like to check the selected item in the BottomNavigation which was previously done using a string. However, with Type-Safe Navigation, I'm unable to cast NavDestination to a Serializable object.

  • @9Blurke9
    @9Blurke9 7 หลายเดือนก่อน +2

    Now we need another navigation video to compare all the options with pros and cons for each 😄

  • @filipmanevski9872
    @filipmanevski9872 7 หลายเดือนก่อน

    Can you make a video on how to implement this way of navigation, using a navigation drawer for example or a bottom nav bar?

  • @BugraKaraahmetoglu
    @BugraKaraahmetoglu 7 หลายเดือนก่อน +1

    Could you please explain how we can safely integrate vertex AI into the application with Google Cloud Console. I need this urgently.

  • @oneclickmobiledevelopers7825
    @oneclickmobiledevelopers7825 6 หลายเดือนก่อน

    Which theme you are using in the android studio, It's awsome..!

  • @rahathossainhimel7177
    @rahathossainhimel7177 7 หลายเดือนก่อน +1

    Finally. Thank you Philipp

  • @TheRobertJamison
    @TheRobertJamison 5 หลายเดือนก่อน

    Even more relevant as of July 3rd, since JetBrains released version 2.8.0-alpha08 of their KMP compatible version of navigation-compose.

  • @santyas
    @santyas 7 หลายเดือนก่อน

    Great Video!!! How do you retrieve args from the destination viewModel directly? If I use savedStateHandle inside viewModel still needs to safe the possible null argument using ?: or !!

  • @wilkq1110
    @wilkq1110 4 หลายเดือนก่อน

    hi Philipp, is nice video, Could you please tell us if this new approach to navigation works well as well with bottom bar navigation ?

  • @cfa532
    @cfa532 3 หลายเดือนก่อน

    I am using ver rc01 and met a strange problem when passing two arguments in a data class object. The 2nd argument sticks the value of its first time usage, never changes in the afterward calls. I have to use the old way to get around this.

    • @Dizzyslizzy
      @Dizzyslizzy 3 หลายเดือนก่อน

      I used a json + simple kotlin class to get around this.
      shouldn't need to tho...

  • @gauravkumar-bs3pf
    @gauravkumar-bs3pf 25 วันที่ผ่านมา +1

    Can we use this in KMP?

  • @samuelwakoli
    @samuelwakoli 7 หลายเดือนก่อน +1

    Is Kotlin Multi-Platform industry ready?
    Can I migrate my Flutter project to KMP?

  • @Revitalish
    @Revitalish 6 หลายเดือนก่อน

    i'm trying so hard to understand where was the problem in passing arguments to screens till now? i mean I haven't tried passing anything except for the ViewModel instance. was that wrong? and if so, then how do I share same ViewModel instance with multiple screens (including nested navGraph)?

  • @kurtispalu
    @kurtispalu 6 หลายเดือนก่อน

    How do I reference the object into a navigation drawer argument? I keep getting crashes when I try to use a var to carry the object name into the navigation drawer item. Thanks

  • @siddharthshakya09
    @siddharthshakya09 5 หลายเดือนก่อน

    I have deployed 2 production apps which are used by Big Enterprises. I have used voyager and it's seamless till now.
    Is it worth moving to official library?

  • @ordnavile
    @ordnavile 7 หลายเดือนก่อน

    Very good, my project is in its final stages. I'm going to take advantage and refactor it to be cleaner. Thank you very much friend.

  • @Lucky_PhilB
    @Lucky_PhilB 7 หลายเดือนก่อน

    Havent had the chance to play with this yet. How does it deal with deeplinks? And is this implemented for kmp compose?

  • @krasavec7088
    @krasavec7088 4 หลายเดือนก่อน

    Is it possible to use that with nested graphs?

  • @gloooooom6229
    @gloooooom6229 7 หลายเดือนก่อน

    hi! how would i do it if i have 2 UI sets for 2 usertypes? i have a radiobutton on the signup to identify them. how can i navigate them to the right set of UIs i already have my bottomnav that has 5 screens

  • @mark-147
    @mark-147 7 หลายเดือนก่อน

    Any tips on naming? I already use FooScreen for the actual composable UI.

  • @manjodh
    @manjodh 7 หลายเดือนก่อน

    I am using this approach with shared element transition. When i am navigating from screen A to B. When entering in Screen B I click back button before transition complete the app is getting crashed.Why it is happening?

  • @MonichGPT
    @MonichGPT 7 หลายเดือนก่อน

    Where is type-safe bottom sheet navigation? I don't see it in the docs. So for now we can't use type-safe navigation at all?

  • @PratikSahu18
    @PratikSahu18 7 หลายเดือนก่อน +1

    Will the object be injected to viewmodel like it used to inject with the parameters when using hilt?

    • @BorisJakubov
      @BorisJakubov 7 หลายเดือนก่อน

      private val ScreenA = savedStateHandle.toRoute()

  • @MrBzik1111
    @MrBzik1111 7 หลายเดือนก่อน

    I wonder how other libraries (mentioned in the comments) can get use out of Parcelable. For KMP. I thought It was only android thing

  • @yanneckreiss
    @yanneckreiss 7 หลายเดือนก่อน +1

    Haha I can relate to your joy about this update so much 😂Great video!

  • @СенчуринНиколай
    @СенчуринНиколай 7 หลายเดือนก่อน

    It looks fine with two screens, what about popBackStack , popupTo etc, like in fragments ? When nav logic becomes more complex

  • @ayitinya
    @ayitinya 7 หลายเดือนก่อน

    with this, do you create a separate file called and put in all data classes and objects? what would be a clean way to keep the screens? I have also thought of having a sealed class called Screens and then throwing all screens in there. curious to know what you suggest

    • @ЕвгенийПавлусенко
      @ЕвгенийПавлусенко 6 หลายเดือนก่อน +1

      I personally replaced sealed class with sealed interface and moved all serialized objects & classes to it

  • @zeroarst
    @zeroarst 7 หลายเดือนก่อน

    Is there a way to gradually migrate to this meanwhile still keep the current navigation in xml? Simple the current project has large codebase and too difficult to migrate it in one shot.

  • @darknjko
    @darknjko 7 หลายเดือนก่อน

    Thanks again for that demo. Spot on, as always 👍
    Originaly, it seemed that the routing library was made to handle all routes as deeplinks. I wonder how deeplinks will work with that new approach? Should we write a deeplink handler that would reroute the user to the proper screen? 🤔

  • @arthurabreu1904
    @arthurabreu1904 7 หลายเดือนก่อน +1

    Aaaaand thanks again for sharing man! 🎉🎉🎉

  • @chaitanyapenjuri
    @chaitanyapenjuri 4 หลายเดือนก่อน

    How can we navigate to pop backstack from screenB to screenA with some arguments, please explain

  • @MrMacromicro
    @MrMacromicro 7 หลายเดือนก่อน +1

    Thanks philip ,you are really amazing.

  • @EdwinRebolledo
    @EdwinRebolledo 6 หลายเดือนก่อน

    We can use it in prod apps ? its on alpha or you recommend to use it from now on

  • @lazydeveloper7753
    @lazydeveloper7753 7 หลายเดือนก่อน

    How do I navigate between two graps containing two screens each usi g type safety? Im confused. Please make a video on this.

  • @Alchemist10241
    @Alchemist10241 7 หลายเดือนก่อน

    with this approach how can we do a shared transition between screens?

  • @뚜릅-i6c
    @뚜릅-i6c 7 หลายเดือนก่อน

    Can I use the library normally in kmm?
    Is it superior to voyager and decompose?

  • @ntikomathaba2662
    @ntikomathaba2662 6 หลายเดือนก่อน

    Is this the best navigation for Compose Multiplatform?

  • @kayiJr
    @kayiJr 7 หลายเดือนก่อน

    I once said XML way of navigating was better than Compose. Now it's getting better. 😀

  • @rifatkhadafy9786
    @rifatkhadafy9786 3 หลายเดือนก่อน

    but what will happen if theres multi module,
    like screen from Module A want to navigate to Module B and with Multiple Different Object
    the problem
    i cant import directly Module B to Module A it will cause circular dependency

    • @PhilippLackner
      @PhilippLackner  3 หลายเดือนก่อน

      @@rifatkhadafy9786 navigation setup doesn't belong in any module that's not the app module. For learning this properly, check my essentials bundle:
      pl-coding.com/android-essentials-bundle

  • @michakazmierczak4464
    @michakazmierczak4464 7 หลายเดือนก่อน

    how to use this with multi module project with feature modules not depending on each other just like android recommends?

  • @MrMindfullness
    @MrMindfullness 7 หลายเดือนก่อน

    I have purchased Essentials course. Will this be incorporated in the course as well?

  • @levlevkin1325
    @levlevkin1325 7 หลายเดือนก่อน +1

    Thanks Philipp! This is amazing!

  • @kuromujou1346
    @kuromujou1346 7 หลายเดือนก่อน

    looking forward you make a video about this but with multiple nested graph. im newbie and im so confuse right now.

  • @Jon88938
    @Jon88938 7 หลายเดือนก่อน +1

    Isn't it still not ideal that you have to do NavBackStackEntry.toRoute()? like you could accidentally you use the wrong class surely?

  • @AKnght
    @AKnght 4 หลายเดือนก่อน

    Is this out for Compose Multiplatform yet? Great video!

  • @MO1NKHAN
    @MO1NKHAN 7 หลายเดือนก่อน

    OMG, I wish this could have come earlier. In my first app I have spent so much time and effort just to handle navigation without relying on 3rd party libraries.
    I have an e-commerce app running in production with lots of screens hanging on those route strings. It's time to refactor and remove all that boilerplate code.

  • @Ayor88
    @Ayor88 7 หลายเดือนก่อน +1

    I've add it to my project and it works really well but now I'm flooding with logcat message : "updateAcquireFence: Did not find frame." This doesn't crash the app or anything, but it's really annoying.

    • @Matthew01369
      @Matthew01369 6 หลายเดือนก่อน

      Hi there, did you manage to fix it? It's happening to me also

    • @vsv8161
      @vsv8161 6 หลายเดือนก่อน

      Same problem

  • @AIejandroide
    @AIejandroide 7 หลายเดือนก่อน

    Hey Philip, how do you keep updated with all these new features from each library?

    • @PhilippLackner
      @PhilippLackner  7 หลายเดือนก่อน

      Android docs, Twitter, blogs, etc

    • @AIejandroide
      @AIejandroide 7 หลายเดือนก่อน

      @@PhilippLackner but who do you follow on twitter? Or which blogs? Thank you.

  • @Guilo583
    @Guilo583 7 หลายเดือนก่อน

    thanks for video. Is this new lib support compose Multiplatform ?

  • @LEEJIHUN
    @LEEJIHUN 7 หลายเดือนก่อน

    I was wondering how to migrate the code when using it with BottomNavigation or NestedNavigation

  • @sijanneupane
    @sijanneupane 6 หลายเดือนก่อน

    how to use this with navGraph? since it asks for string in the start destination.
    and we're passing object here.

    • @PhilippLackner
      @PhilippLackner  6 หลายเดือนก่อน

      Navgraphs are also objects with this change

  • @meidy3795
    @meidy3795 7 หลายเดือนก่อน +1

    Good information Phillip ! Thos wpuld really helped my ptoject for compose multiplatform

  • @زيد_اليماني
    @زيد_اليماني 7 หลายเดือนก่อน

    Wow, this really is a lot easier than it used to be

  • @JeeteshSurana
    @JeeteshSurana 7 หลายเดือนก่อน

    is it also available for KMM?

  • @radheshyampatel5578
    @radheshyampatel5578 7 หลายเดือนก่อน +3

    I am Big fan of yours video 🎉

  • @random-videos96
    @random-videos96 6 หลายเดือนก่อน

    Nice but how can we achieve this if we are using dependency injection and need these args in a view model?

    • @PhilippLackner
      @PhilippLackner  6 หลายเดือนก่อน

      They're still part of saved state handle

    • @random-videos96
      @random-videos96 6 หลายเดือนก่อน

      @@PhilippLackner yes but only single args as a string. What if we need the whole data class as a param in a view model?
      I guess assisted injection come to the rescue

  • @andrianbantero3462
    @andrianbantero3462 6 หลายเดือนก่อน

    how does this work on a nested navigation?