I have an observable object in SwiftUI with multiple published properties. When my app starts I want to update the values of all of these properties by making an API call. That is easy, and I have managed that.
However, every time one of these property changes, I make an update API call to the backend. For ease of use, I do any update to any of these properties will update all of the properties on the backend.
The problem is the beginning. How do I "silently" update the individual properties in the first API call without setting off the published chain of events that update "all" of the API calls. This obviously leads to a problem since my initial state has several blank fields that would get overwritten in the backend.
Basically, is there a way to update a "Published" value without triggering the publish subscription call?
Post
Replies
Boosts
Views
Activity
Hello,
I am building an application in SwiftUI and I have put a Link View in a List View, beside some Navigation Links.
All of my views contain an Image and then some text. For the navigation links, when I touch the white space that is not covered by either an image or text, the navigation link will activate, but that is not so when I set up the Link.
I have tried setting the .frame(maxWidth: .infinity) parameter on both the Link, as well as the Text View on the inside of the link to try and get this to work but to no avail.
The hacky solution that seems to work is to pad the Text View with an enormous amount of blank space. This is hacky, but it at least gives the desired behavior, though I do worry about it breaking on some update.
Here is simplified code below:
List {
Link(destination: "https://google.com") {
Image(systemName: "bell")
Text("Doesn't activate in white space")
}
}
If you build a test example, you'll see that if you press on the space not covered by text, the link will not work. This is not desired behavior. Changing .frame options does not help. How do I do this properly?