Reputation: 793
All articles I read put @ObservationIgnored
for private properties. However, Apple in their Focus Cookbook sample project, didn't put @ObservationIgnored
to private properties.
Upvotes: 2
Views: 943
Reputation: 155
Apple's documentation [1] says
Observation doesn’t require a property wrapper to make a property observable. Instead, the accessibility of the property in relationship to an observer, such as a view, determines whether a property is observable.
If you have properties that are accessible to an observer that you don’t want to track, apply the ObservationIgnored() macro to the property.
Upvotes: 1
Reputation: 11666
my two cents... I think a decent explanation is on ADC site:
https://forums.developer.apple.com/forums/thread/763664
I found interesting the effect of "private".
Useful for others:
"@Observable" macro cannot be prepended to computed vars: You got:
'extension' macro cannot be attached to property ('....')
seems to me weird.. but is allowed to prepend "@ObservationIgnored " to computed property without warnings / errors. (maybe wanted..)
Upvotes: 0