Previous episode: 18. Using a GlobalActor
Next episode: 20. Conclusion
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
In this challenge, you'll finish the debugging toolbar by connecting the second counter to display on disk cache hits and making the last toolbar button clear the disk cache. You should do something similar to what you did in image loader for the in-memory counter. In ImageDatabase, add an AsyncStream for the counter. Set up the stream in setup, manually complete it in a D init, and increment the counter when you have an actual disk cache hit. Update the toolbar view to iterate over the stream and make the last toolbar button clear the disk cache. Good luck. (gentle music) Welcome back. Hopefully you had success with this task. Here's how I did it. It's similar to what you did in image loader. In ImageDatabase, I added an AsyncStream for the counter. I set up the stream in the actor setup and manually completed the stream in a D initializer. I incremented the counter in image below the print in disk cache statement. At the end of clear, I reset the counter to zero and printed a message. Then in BottomToolbar below the other task, I added a task to iterate over the stream. Finally, I made the first toolbar button clear the disk cache. Now the disk counter works. When I clear both the disk and memory caches, the app fetches the images from the server. Congratulate yourself on a super useful debugging tool.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.