You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While attempting to capture a view that includes AsyncImage or revealing a component after a specified duration, it's been noticed that the resulting snapshot doesn't include images loaded via URL or views that appear with a slight delay. Even when using .snapshot(delay: 1.0), there's no noticeable improvement in this scenario.
What π±
To overcome this challenge, it would be helpful to incorporate an option to wait before taking the snapshot. This way, we can ensure that the snapshot accounts for the asynchronous loading of images and views that emerge after a delay.
Example of a view that isn't properly captured in the snapshot:
struct DummyView: View {
@State var isButtonHidden = true
var body: some View {
VStack {
Text("Some text")
Text("Some text with delay")
.opacity(isButtonHidden ? 0 : 1)
}.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self.isButtonHidden = false
}
}
}
}
The text was updated successfully, but these errors were encountered:
sparafinski
changed the title
Way to wait for view to fully load
Wait before capturing a snapshot
Nov 22, 2023
Also, it seems that .preferredColorScheme(.dark) is not handled properly. I found a PR that states it should already work π€ using swift-snapshot-tests . Do you think it could be the same cause?
Context π΅οΈββοΈ
While attempting to capture a view that includes AsyncImage or revealing a component after a specified duration, it's been noticed that the resulting snapshot doesn't include images loaded via URL or views that appear with a slight delay. Even when using
.snapshot(delay: 1.0)
, there's no noticeable improvement in this scenario.What π±
To overcome this challenge, it would be helpful to incorporate an option to wait before taking the snapshot. This way, we can ensure that the snapshot accounts for the asynchronous loading of images and views that emerge after a delay.
Example of a view that isn't properly captured in the snapshot:
The text was updated successfully, but these errors were encountered: