Best of Kotlin โ June 2024
- 1
- 2
- 3
Mediumยท2y
Kotlin Lazy vs Lateinit Explained
The post explains the differences between lazy and lateinit property initializers in Kotlin. Lazy initialization is used for immutable properties (val), ensuring they are initialized when first accessed, which can help with resource management. Lateinit is used for mutable properties (var) and must be initialized before use to avoid runtime exceptions. The post also discusses when to use these initializers, provides code examples, and touches on advanced concepts like using delegates for primitive types.
- 4
ProAndroidDevยท2y
Data Mapping In Kotlin Explained
Exploring different methods for data mapping in Kotlin: extension functions, additional constructors, and a mapper interface. Extension functions are non-intrusive and easy to integrate, constructors are limited and intrusive, while the mapper interface is ideal for new projects due to its flexibility and support for generic mapping algorithms.
- 5
- 6
- 7
ProAndroidDevยท2y
๐ฅณ Finally! โ Working Samples ๐ in Android Studio
Learn how to display source code samples in Android Studio, similar to how Google does it in their material for compose library. Keep samples up-to-date by adding the samples module as a dependency to the demo app module. Consider adding images to KDoc of samples for better visualization.