When migrating from ObservableObject to the @Observable macro in Swift, lazy variables cause a compiler error ('lazy' cannot be used on a computed property') because the macro tries to synthesize observation logic for all properties. The fix is to annotate the lazy var with @ObservationIgnored, which tells the observation system to skip that property.

2m read timeFrom nilcoalescing.com
Post cover image
1 Impression