-
Notifications
You must be signed in to change notification settings - Fork 101
Conversation
* ``` | ||
*/ | ||
@SuppressLint("RestrictedApi") | ||
fun <V : TiView> TiPresenter<V>.sendToViewKotlin(block: V.() -> Unit) = sendToView { block.invoke(it) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about at least name it sendToViewKt
as all Kotlin stuff is suffixed with Kt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some alternatives: withView
, withAttachedView
, waitForView
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the recommendation.
I think we should go with @Syex idea here because... well, it make sense 🙃
Using a complete different name for an "extension" is just confusing IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to go with @passsy 's suggestion. We should not include some language specific abbreviations in our public API.
My prefered candidate would be withView
. Reason: It makes sense.
|
🔴 Ready for another round 👍 |
README.md
Outdated
@@ -250,6 +253,30 @@ public class HelloWorldActivity extends TiActivity<HelloWorldPresenter, HelloWor | |||
|
|||
`LoggingInterceptor` is available as module and logs all calls to the view. | |||
|
|||
### Kotlin | |||
|
|||
Using Kotlin these days is a no brainer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a part that the user has to include net.grandcentrix.thirtyinch:thirtyinch-kotlin
README.md
Outdated
Using Kotlin these days is a no brainer. | ||
`ThirtyInch` provides some extension methods to improve itself even further! | ||
|
||
Take a look at the `sendToViewKt` example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change sendToViewKt
here to deliverToView
aswell
* ``` | ||
*/ | ||
@SuppressLint("RestrictedApi") | ||
fun <V : TiView> TiPresenter<V>.deliverToView(block: V.() -> Unit) = sendToView { block.invoke(it) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider to write block(it)
instead of block.invoke(it)
Nice addition @StefMa ! 🐶 |
This will introduce a "basic" implementation for Ti-Kotlin.
Currently it is just the module and the extension function
TiPresenter.deliverToView(block: View.() -> Unit)
.See also this PR: #142
I'm not quite happy with the function name. But because Kotlin uses the implementation function over the extension function it isn't possible to name them equally.
If you have a better name feel free to post it here...