Delightful Delegate Design
summary
Shows how Krate, an Android SharedPreferences wrapper, is built with Kotlin property delegates so properties read and write to prefs with normal syntax; implements an int delegate via ReadWriteProperty and a JSON delegate using GSON, fixes type-erasure with reified generics in inline factory functions, and preserves encapsulation with @PublishedApi plus internal delegate classes and extension factory functions. Useful if you want concrete patterns and code-level solutions rather than high-level theory.
AI-written summary · about
chapters (10)
- 0:00Introduction and welcome
- 1:04Kotlin delegates basics
- 9:12Crate library overview
- 11:20Implementing int delegate
- 16:55Visibility and API design
- 20:45Handling unsupported types
- 26:26Reified generics and type erasure
- 31:05Crate’s real API details
- 32:09Dependency injection with Crate
- 33:31References and closing
