-
Notifications
You must be signed in to change notification settings - Fork 101
Made sendToView public to allow to override or extend the function. #142
Conversation
You could extend or override the function with the protection modifier as
well.
What is your use case? 🤔
…On Feb 20, 2018 2:58 PM, "rehlma1989" ***@***.***> wrote:
------------------------------
You can view, comment on, or merge this pull request online at:
#142
Commit Summary
- Made sendToView public to allow to override or extend the function.
File Changes
- *M* thirtyinch/src/main/java/net/grandcentrix/thirtyinch/
TiPresenter.java
<https://github.com/grandcentrix/ThirtyInch/pull/142/files#diff-0> (2)
Patch Links:
- https://github.com/grandcentrix/ThirtyInch/pull/142.patch
- https://github.com/grandcentrix/ThirtyInch/pull/142.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#142>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJwYe6zlk6pftkldf74I0X_8NLG5zIQIks5tWs-ZgaJpZM4SL_l8>
.
|
@rehlma1989 This method is intended just for Presenter internal use. So it should not be opened to external classes. |
The protection modifier prevents us to create an extension function in Kotlin which uses |
To clean up some things: fun <V : TiView> TiPresenter<V>.sendToViewKotiln(block: (V.() -> Unit)) {
sendToView { v -> v.block() }
} This will give us the benefit that the receiver is not a param ( fun aMethod() {
sendToView { it.showLoading(); it.showAnotherThings(); it.doWhatever() }
} we can use: fun aMethod() {
sendToView { showLoading(); showAnotherThings(); doWhatever() }
} Since Kotlin extensions are just static java methods we can't create such a extension without a public method. |
To speak about pros/cons: After seeing the benefits of it I'm not against this change. |
That UseCase definitely make sense. Is it possible to restrict the usage than by |
|
Great! Just did it. |
No description provided.