Easy SharedPreferences with Delegated Properties in Kotlin

preview_player
Показать описание
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:

🚀 I just launched a new email newsletter!

More fun with extension operator functions!

More about extension functions:

More about reified type parameters:

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!
Рекомендации по теме
Комментарии
Автор

You are doing a great job, Dave! Bravo!

shubhamnanche
Автор

So much of in depth industry level knowledge in one video 🙌🏻 please continue uploading such videos

akashkhatkale
Автор

This was a great way to see delegates in action and also an interesting example of working with generics + reified. Thanks for putting it together!

jessehill
Автор

great Explanation, just found your channel and subscribed immediately.

behnamahmadi
Автор

Thanks for the detailed explanation of different approaches. Expecting more videos from you on Kotlin programming.

vengateshm
Автор

best content on kotlin I've ever found, congrats! Please more!

wagnerarcieri
Автор

I really liked the type video, nice work, going to check more!

Carlos-xzzq
Автор

amazing video! You explained it concise and step by step, from easy to hard. Thanks a lot bro you inspired me a lot

jackli
Автор

somehow youtube recommended me this video which is awesome. i'm looking forward to see more videos from you, but in the meantime you got me as a subscriber.

AndreiBacalu
Автор

Nice video! When i have to do a comparison of the sort you did between the Boolean and Float delegates, I'll copy one version into the clipboard, select the other version, and then use Compare Clipboard to Selection (I think thats the name, I'm on my phone away from my laptop!)

PeteC
Автор

This is really great content! I already learned so much. I wish you all the best and hope you will make more videos 🙂

hmro
Автор

Very interesting and good presentation of the material. Keep up the good work. Good luck! subscription

aiklklivlind
Автор

That was super informative, Thank you!

mdisi
Автор

Amazing video as always. I was wondering if there is something similar that is not specific to Android?

BewareOfStinger
Автор

One of the best explainer videos! something like this for a Sqlite Database !?

skytech
Автор

Excellent explanation of delegates. However this is not really "easy" once you get past the initial version. SharedPrefs are quite easy to use--I fail to see the need for all this complicated code to do something that already works well and is straight-forward.

scottbiggs
Автор

For the overloading of getters problem, would @JvmName be an appropriate solution?

cal
Автор

Thanks for the information. How can I make my list automatically save to the shared preferences again when an item is removed or added to it? I have been struggling to find a solution for this problem. Thanks.

lg.studio
Автор

Could you make videos on Difference between videos like -> Extension fun vs Delegates

deepakshah
Автор

make one video with sharefPreferences in fragment without to user Activity.

lglf