-
Notifications
You must be signed in to change notification settings - Fork 44
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
"syncStateSummary" not @Published
#18
Comments
@Published
Hi @benguild, The SyncMonitor class itself is an So, if you do:
then in your View include
Then |
Sorry for the delay! So, I guess the downside there is it'd recalculate the view whenever anything changes, even outside of the visual linked to "syncStateSummary" ...? In this case it might be OK, but in others it might be less ideal depending on what's going on. |
Ok, now I apologize for the delay... My understanding is that, because SyncMonitor is an ObservedObject, that any public properties within it will behave, for practical purposes, like they're Published - that is, your Are you using SyncMonitor outside of SwiftUI, and/or seeing an issue with |
Right, so I guess the downside is that it requires observing the object rather than just that one property. It'd be nice to have that as a choice, but since the property is computed it would need to be stored, calculated initially, and then updated only when it changes. |
I was looking at this library and noticed that this property, although useful, is not
@Published
.... So, in order to catch changes on it, one would need to monitor changes to a half dozen or so other properties.It seems potentially wasteful (although not terribly) to calculate this in advance for publishing if not used, but it's also a hassle to monitor so many other properties.
Just wanted to ask if there was potentially a compromise here, or if you had best practices in mind regarding this. 😅
The text was updated successfully, but these errors were encountered: