Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

SwitUI preview loads indefinitely

Hi! I develop an iOS library and I met an issue with SwiftUI previews in iOS app project with my library integrated. After I open preview, build for preview finishes successfully, but preview itself never appears. I failed to find any error messages or any other indicators of what went wrong or how to fix it. Switching to legacy preview execution seems to fix problem, but I think that is not ideal. Could you help fixing this?

Xcode 16.2, Simulator iPhone 16, iOS 18.2

Project to reproduce - https://drive.google.com/file/d/1cU6JKwshK_wQfe9YIqcMg3UGWq45OYlx/view?usp=sharing

Preview diagnostics - https://drive.google.com/file/d/1kPcgVSSqreiepGuqhdIoCW2rLSicgsWr/view?usp=sharing

Answered by Frameworks Engineer in 838663022

Awesome! Thanks so much for bearing with me on this. Would you mind filing a feedback about this? If not, I can file one but that's the easiest way for you to track the resolution, too. I can add the diagnostics you've shared here and extra context from our chat. We'll need to engage with other teams to figure out what's going on.

From what I can see the YandexMobileAds library is tripping up the runtime linker under previews. There's a whole lot of stuff going on when previews tries to load and reconstruct the process at runtime. Learning of specific examples like this is fantastic! We can run with this and dig in but it will take some time to figure out across all the components.

Thank you!

Thanks for posting the diagnostics and screenshot. There's known issues in Xcode 16.2 and iOS 18.2 that we've been working to fix in later builds. Xcode 16.3 is out now and 16.4 beta 1 is also out. If you're able to try out the beta we'd love to know if this has improved for you. But even if you don't want to take that risk, do please update to 16.3.

If you do continue to experience issues please file a feedback with new diagnostics. We've been improving the diagnostics with each Xcode and OS version trying to catch all the interesting quirks that make projects unique.

Thanks for reply! I tried with newer xcodes and issue is still here.

xcode 16.3 diagnostics report - https://drive.google.com/file/d/1PmTbmDjIY6VU_g0j2p1qP39zCo2vz8st/view?usp=sharing

xcode 16.4 diagnostics report - https://drive.google.com/file/d/1mx2ud4Ock0pRSNL9Llp1PUTtu38RZhpg/view?usp=sharing

Thanks for the quick turnaround. Looking through the logs it looks like in both cases you let things run for a brief moment then captured the diagnostics. Unless I'm mistaken, unfortunately these are missing the key points in time I was looking for. I see the workspace build and the last log lines I see we are gathering up the details of the build graph to proceed. Previews didn't even go through the process of attempting to launch yet.

Since you're have 16.4 let's just focus on that. Please open your project and press command-b to trigger a full workspace build before previewing. Then trigger a preview and let it sit for about a minute. Capture the diagnostics after that and let's see what happens.

Yes, I guess you are right - I didn't wait for too long before generating previous reports. Been waiting for ~5 minutes for this report - https://drive.google.com/file/d/1-72Pr23X_N5A6Ok6iRJcGDYGGgtr3fro/view?usp=sharing

Accepted Answer

Awesome! Thanks so much for bearing with me on this. Would you mind filing a feedback about this? If not, I can file one but that's the easiest way for you to track the resolution, too. I can add the diagnostics you've shared here and extra context from our chat. We'll need to engage with other teams to figure out what's going on.

From what I can see the YandexMobileAds library is tripping up the runtime linker under previews. There's a whole lot of stuff going on when previews tries to load and reconstruct the process at runtime. Learning of specific examples like this is fantastic! We can run with this and dig in but it will take some time to figure out across all the components.

Thank you!

Sure, here is feedback FB17546894. Thanks a lot for answer!

Received, thanks!

SwitUI preview loads indefinitely
 
 
Q