Easy SharedPreferences with Delegated Properties in Kotlin

Опубликовано: 07 Ноябрь 2022
на канале: Dave Leeds
9,029
578

With Kotlin's property delegates, you can easily customize the behavior of a property. In this video, we'll learn how Kotlin's delegated properties work, by turning Android's SharedPreferences into a delegate.

To see this code working within the context of a full Android app, see the companion code:
https://github.com/djleeds/video-shar...

✨ New to Kotlin? Start here: https://typealias.com/start/
... or pick up the new Leanpub Edition! https://book.typealias.com/

🚀 I just launched a new email newsletter!
Sign up here: https://newsletter.typealias.com/

More fun with extension operator functions!
   • 5 Fun Ways to Use Extension Functions...  

More about extension functions:
https://typealias.com/start/kotlin-re...

More about reified type parameters:
https://typealias.com/guides/getting-...

Chapters:
00:00 Introduction
00:45 Introduction to Property Delegates
03:18 Simple SharedPreferences Delegation
07:24 Exploring Improvements
10:00 Advanced SharedPreferences Delegation
20:47 Conclusion

If you've got ideas on how we could improve the code in this video, let me know in the comments!