As noted in Swift with Majid, the trigger-value pattern is becoming a thing in SwiftUI.
π Trigger value pattern in SwiftUI
Basically, this pattern lets you “trigger” some user experience when some specified data changes.
In one example, when a list of messages changes, then the app automatically immediately trigger some haptic/sensory feedback. And it only takes one extra line of code.
.sensoryFeedback(.impact, trigger: messages)
The post gives another example of flashing the scroll indicator in the same manner.
And it goes into making your own custom triggers.
This is cool stuff and such a simple + powerful way to make your app more responsive.
