Skip to content

[Observation] Reduce the scope of the observation shouldNotifyObservers to only apply to observation and not side effects of accessors like willSet or didSet #79518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

phausler
Copy link
Contributor

There is a degenerate case which a developer may have relied on a side effect of a didSet that has a repetitious value. This restores that case such that properties in the form:

var foo: Int { didSet { print("applied") } }

When setting foo = 3 and then setting it again foo = 3 now restores the behavior of printing "applied" twice. This still leaves observation informing a change once.

…ers` to only apply to observation and not side effects of accessors like willSet or didSet
@phausler
Copy link
Contributor Author

@swift-ci please smoke test

@phausler
Copy link
Contributor Author

@swift-ci please smoke test

@phausler phausler merged commit a3d6992 into swiftlang:main Feb 21, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants