Hey Guys, I have recently started using Compose an...
# compose
s
Hey Guys, I have recently started using Compose and I was using previews to show different states of my views. Now Most of my classes in the application are abstractions so I was able to generate mocks for them and use them accordingly to show different states. but in case some of the final classes that I am using have their constructors as internal. as they should not be initialized from outside of the module. How do I use them? and is this the right approach to make these extensive previews? And should I use mocking libraries like Mokito or Mockk to get this done?
z
Previews typically live not only in the same module but even the same file as the composables they’re previewing, so can call internal code just fine.
s
Ok and what is you opinion about using mocks over repositories and Use-cases just for previews? is it an overkill and should we be using mocking libraries and doubles in our main packages? Though they would not be a part of release builds after applying proguard
m
i don’t understand why you have usecases in your UiLayer. You composable functions should receive state only.
s
Yup you are right. I am breaching layer boundaries. Thank you for the helping me realise that 👍
👍 1