Closed thomas-sempf closed 6 months ago
This is sadly a SwiftUI bug in which @AppStorage
simply doesn't work in escaping closures. You'll see the same behavior if you swap WithPerceptionTracking
out for a GeometryReader
. To work around, you can move @AppStorage
into its own dedicated subview.
We also recommend filing feedback with Apple if you'd like this bug to be fixed!
Since this is a bug with SwiftUI and not the library, I'm going to convert to a discussion.
Description
The bug occurs in Views which are using WithPerceptionTracking and have one or more properties defined via @AppStorage. In this case a view update is not triggered when one of the @AppStorage properties changes. PerceptionBug.zip
Checklist
@Observable
macro or another tool from theObservation
framework, please file it directly with Apple.main
branch of this package.Expected behavior
View updates are still happening when @AppStorage properties changes
Actual behavior
No update is triggered
Steps to reproduce
Perception version information
1.1.6
Destination operating system
iOS 16
Xcode version information
15.3
Swift Compiler version information