Google helps developers clean up their code with Android KTX
Android KTX is Google’s attempt to make writing code for their platform in Kotlin easier and more concise.
Ever since Google announced first-party support for the Kotlin programming language, many developers have been experimenting with it. As expected, when developers are getting to grips with a new language, this has led to some messy code.
Kotlin itself is designed to be friendly and easy to pick up, especially when in comparison to Java. However, that doesn’t mean there’s not room for improvement.
KTX provides an API layer on top of both Android framework and Support Library to make writing Kotlin code more natural.
In the announcement post, Google provides the following example of translating the difference between two paths by 100px in standard Kotlin vs with Android KTX:
The API is currently in preview but the portion of Android KTX that covers the Android framework is now available in Google’s GitHub repo.
What are your thoughts on Android KTX? Let us know in the comments
Culled from: DevelopTech