Code Monkey home page Code Monkey logo

Comments (3)

raamcosta avatar raamcosta commented on May 27, 2024

Ksp task runs in each module separately and so it doesnโ€™t know about classes in other modules.

This is for now expected and you do have to use the Open approach. I would like to know why does it make things very complicated, can you give me more info about that?

When manually calling your screen, you should be in a position where you can easily prepare the same dependencies you were in dependencyContainerBuilder, right?

Iโ€™ll keep this open though maybe I have an idea about how I could improve this for v2.

from compose-destinations.

SiavashB avatar SiavashB commented on May 27, 2024

Ok so the recepient screen looks like this

fun RecepientScreen(
    viewModel: RecepientViewModel,
    resultRecipient: OpenResultRecipient<CustomType>
) {
}

that view model gets injected through your library using dependenciesContainerBuilder. We do this because we are sharing that VM between 2 screens and we want it to stay alive and shared between those 2 screens.

in the Destinations nav host if I try to manual create the screen then I have to manually pass in the view model and I'm not sure how to do that while maintaining that shared view model functionality

DestinationsNavHost(
 dependenciesContainerBuilder = {  CreateRecepientScreenVM()   }
) {
                    composable(RecepientScreenDestination) {
                        RecepientScreen(
                            viewModel =  / what goes here? /,
                            resultRecipient  = resultRecipient<ResultProducerScreenDestination, ResultType>())
                    }
                }

CreateRecepientScreenVM() is an extension function we created to create the viewModel but it only can be called in the context of dependenciesContainerBuilder

from compose-destinations.

raamcosta avatar raamcosta commented on May 27, 2024

Sorry for delay in response here ๐Ÿ™

There is no reason why CreateRecepientScreenVM() should be able to be called in one place but not the other. Both have similar receivers in the lambda (Some kind of DestinationScope).
Try having the CreateRecepientScreenVM be an extension function of DestinationScopeWithNoDependencies. Then you should be able to call it on both manual calls and dependency builders cases ๐Ÿ™‚

Hope this helps!

from compose-destinations.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.