Android-CleanArchitecture-Kotlin icon indicating copy to clipboard operation
Android-CleanArchitecture-Kotlin copied to clipboard

UseCase dependencies

Open nikolajakshic opened this issue 7 years ago • 2 comments

I thought UseCases shouldn't have any framework dependencies but PlayMovie has a Context in it and a Navigator which contains android specific code. I'm a little bit confused, am I missing something?

nikolajakshic avatar May 15 '18 11:05 nikolajakshic

Those are implementation details which inherit the abstraction UseCase which is what from my perspective belongs to the domain layer.

Otherwise, I do not see any other way to achieve those actions through UseCases.

android10 avatar May 17 '18 08:05 android10

Use cases should live in the domain layer and be free of framework code. The domain layer should be free of framework code!

The way round this issue is to create an interface for the Navigator, just like we have interfaces for repositories. The implementation of the Navigator would be in app most likely where it can use the context.

dhaksddj avatar May 17 '18 09:05 dhaksddj