@darkpaw So I was able to find out that a chunk of code in my viewModel's loadData() function is what's causing this issue. loadData() gets called only once and it's when the view appears. The code in question has nothing to do with the sheet code @Published var so I don't understand why it's causing the issue. But if I comment this out it works as I would expect. For reference shareImage is not a @Published var.
I understand you saying you think I'm doing something "wrong" but why would it work on devices that aren't running iOS 17? I don't understand what changed.
if let shareImageString = response.images?.first, let shareUrl = URL(string: shareImageString) {
URLSession.shared.dataTask(with: shareUrl) { [weak self] data, _, _ in
guard let data = data, let self = self else { return }
if let uiImage = UIImage(data: data) {
self.shareImage = uiImage
}
}.resume()
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: