EventBus is a design pattern which allows publish-subscribe style communication without requiring components to registering with each other. Most of the android developers have used a library for
EventBus. EventBus by Greenrobot is a pretty famous library and widely used. It was quite impressive how you could send any object and the subuscriber would receive it without any hassles.
Kotlin has been on the rise since past couple of years, especially for android app development. I also started learning the language by making an app. I required
EventBus so I thought of implementing it myself in Kotlin with the help of Rx (RxKotlin) and it turned out to be super short and quite easy.
That’s it! It’s that simple. And this is how I use it.
It means to make something, which is abstract, concrete or real. When we need to access the type passed in the parameter, we can use
reified type parameters which gives us run-time access to types passed to the function. Read more about it - reified specs.