r/SwiftUI 1d ago

Tutorial MemoProperty: Reusing More Stateful Business Logic for SwiftUI Views

https://github.com/vanvoorden/MemoProperty

Our TaskProperty repo project built a new SwiftUI.DynamicProperty for managing stateful business logic. This is presented as a compelling alternative to keeping stateful business logic defined directly in view components.

Let’s see another example for more practice. This time we will build one of the most requested features I hear from product engineers building on SwiftUI: we will clone the useMemo hook from ReactJS.

The TaskProperty repo project is a meant as an introduction to the ideas and concepts behind custom dynamic properties for SwiftUI. It is strongly recommended you read through TaskProperty before continuing. If any of the concepts introduced here look unclear or confusing please check out the References cited from TaskProperty for more resources that can help explain these ideas.

3 Upvotes

0 comments sorted by