Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AlexMisiulia/7cdeeb67a188434da8b76732410eeb06 to your computer and use it in GitHub Desktop.
Save AlexMisiulia/7cdeeb67a188434da8b76732410eeb06 to your computer and use it in GitHub Desktop.
data class PractitionersModel(val data: Any)
object Network {
fun requestPracticioners(onSuccess: (PractitionersModel) -> Unit, onError: (Throwable) -> Unit)
{
// типа сетевой запрос
}
}
interface Activity {
val adapter: Adapter
fun onCreate() {
Network.requestPracticioners(onSuccess = {practicioners ->
adapter.setPracticioners(practicioners)
}, onError = {
displayError(it)
})
}
fun displayError(it: Throwable)
}
interface Adapter {
fun setPracticioners(practicioners: PractitionersModel)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment