https://kotlinlang.org logo
#android-architecture
Title
# android-architecture
s

suhas

08/22/2021, 10:13 AM
Working on a very small project. Don't plan to add DI for now. Is it okay to pass
context
to Presenter in MVP?
u

ursus

08/22/2021, 11:14 AM
anything is fine if you dont create memory leaks
👍 1
s

suhas

08/22/2021, 12:47 PM
Thanks
g

George Theocharis

08/22/2021, 12:55 PM
Strictly speaking a presenter should be platform agnostic thus no context. Most of the times it won’t matter as you won’t reuse the presenter in another platform unless you are doing Kotlin Multiplatform.
☝️ 1
e

Emiliano Schiavone

08/23/2021, 12:29 PM
If you want to apply a stregth MVP, you should not pass any android or view stuff to the presenter
l

Lefko

08/24/2021, 6:59 AM
Or you could use AndroidViewModel, which is a subclass of ViewModel and has a fun called getApplication See: https://developer.android.com/reference/androidx/lifecycle/AndroidViewModel
3 Views