Type Safely

Share this post
Use the onChange modifier in SwiftUI
typesafely.substack.com

Use the onChange modifier in SwiftUI

Daily Coding Tip 028

Type Safely
Jan 15, 2021
Share this post
Use the onChange modifier in SwiftUI
typesafely.substack.com
Image by GreenvalleyPicture from Pixabay

Here’s a version of yesterday’s tip that uses the onChange modifier instead of a button to add up the values. This allows you to have the two numbers add up automatically when either of them changes. The closure for the modifier gets passed the value it changed to, but since both properties are local we don’t need…

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2022 Type Safely
Privacy ∙ Terms ∙ Collection notice
Publish on Substack Get the app
Substack is the home for great writing