-
Notifications
You must be signed in to change notification settings - Fork 102
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
Support for SwiftUI? #252
Comments
Sorry, I haven’t worked much with SwiftUI and I’m not sure. We use the underlying snapshot test case library, maybe check their GitHub repo for similar issues? |
Hi! Got it to work with this setup:
And then:
|
It works! Thanks! |
@robinbonin Thanks for letting us know! |
Hello! I'm experiencing the same issue, and the steps above didn't seem to resolve it. This only seems to happen when I'm testing against iOS 16, not 15.5. When I'm trying to record a new snapshot it's just blank white. Here's the code I'm using:
Any help would be greatly appreciated! I did try looking at the snapshot test case library GitHub page, and didn't find anything unfortunately. If there's any additional info that would be helpful, please let me know! Thank you very much! |
Hey @Ripcord715 Based on @robinbonin's answer I created this extension. At least it is working for me using Xcode 14.0.1 on iOS 16.
And you can use it with any SwiftUI view like this:
|
Thank you very much for the reply @contreras2004 ! I gave it a shot, and unfortunately I'm still getting a white snapshot. |
hmmm, could you post a bit pf your view's code? Maybe I could try rendering it myself |
@contreras2004 - Sorry I wasn't able to get back to you sooner. I asked our iOS developer to take a look at what was going on, and it sounds like our view is loading just after the snapshot is being taken when we use iOS 16. We were able to get a workaround that works for now by preloading the data, but we would rather figure out if it was possible to delay the snapshot being taken until after the view has finished loading naturally. Is there a way to do that in Nimble Snapshots? Thanks again for your help! |
@Ripcord715 Maybe you could try using the Hope it helps 🙂 |
@contreras2004 - Thank you very much, I'll give that a go! |
@Ripcord715 were you able to resolve this? Now i'm having the same issue. I notice that this is because the function that loads the data is in the .onAppear { } of the swiftUI view. |
@contreras2004 - Apologies for not getting back sooner, I wanted my senior dev to take a look at my work before replying. Yes, the View extension along with the .toEventually did work.
|
I had the same problems and with the extension and toEventually worked for me! thank god you guys exist ! |
I have attempted to use Nimble_snapshots with swiftUI Views using a UIHostingController but it just gives me a white snapshot of the window. Ant ideas on how can I make this work or why it does not work?
The text was updated successfully, but these errors were encountered: