watchOS: SwiftUI Runtime Error When Using StateObject/Observed Object
Originator: | alelinapps | ||
Number: | rdar://FB9792055 | Date Originated: | 12/02/2021 |
Status: | Open | Resolved: | Open |
Product: | watchOS | Product Version: | 8.0+ |
Classification: | Unexpected Behavior | Reproducible: | Yes |
Using a StateObject in a view to show different views depending upon certain app state. This has worked in the past, and works currently on iOS. However, when trying to run on watchOS is causes the following runtime error: runtime: SwiftUI: Accessing State's value outside of being installed on a View. This will result in a constant Binding of the initial value and will not update. An ObservedObject causes the constant Binding occurs. With a StateObject, the UI works, but the error remains.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!