Optimizing Swift: Tracking property changes and building a Memoization system

As a Swift consultant, I always look for ways to optimize clients' code and improve efficiency. I recently built a prototype for The Browser Company that tracks changes in Swift properties and implements a memoization system.

This system re-executes complex computation scopes only when necessary, avoiding redundant re-computations and returning cached values when no property changes have been made.

In this article, I'll walk you through the inner workings of this prototype and demonstrate how it can enhance your Swift coding experience.

Here's a final demo from this series where you can see that it will re-compute just the selected Scopes depending on which properties in State I mutate.

0:00
/
Memoized scopes and automatic dependency tracking

This post is for paying subscribers only

Sign up now to read this article and get access to all premium posts.
Already have an account? Sign In

You've successfully subscribed to Krzysztof Zabłocki
Great! Next, complete checkout to get full access to all premium content.
Error! Could not sign up. invalid link.
Welcome back! You've successfully signed in.
Error! Could not sign in. Please try again.
Success! Your account is fully activated, you now have access to all content.
Error! Stripe checkout failed.
Success! Your billing info is updated.
Error! Billing info update failed.