-
Notifications
You must be signed in to change notification settings - Fork 1.6k
SwiftUI previews breaks when adding a watchOS target #7610
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
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Hey @antonbremer - thanks for the report. Unfortunately, Analytics isn't supported on watchOS yet. You can follow along the feature request (#4557) for updates. Due to the way SwiftPM works we can't specify individual platform support per product so we have to wrap it and exclude the binary altogether from the platform it doesn't support - looks like this isn't working for SwiftUI previews though. We'll see if we can come up with a better solution! I'll close the issue for now since it's known not to work but if there's anything else related please feel free to keep commenting. Thanks! |
Hi @ryanwilson, thank you for your quick response! For me personally I don't need Firebase Analytics to work on watchOS to be honest, but it's good to hear there is a feature request for it nevertheless. Just some extra information for you guys on this:
One more question is: "since it's known not to work" < Is there a related issue that I can follow? Thanks! |
Thanks @antonbremer for the extra information! Apologies for the accidental diagnosis - I thought that you were trying to include Analytics on watchOS. I'll re-open this until we can track down the issue. Side note: do you have code coverage enabled by any chance? It could be a similar bug to #6219 but manifested differently, we can investigate that.
This was related to Analytics not working on watchOS, so it's not relevant anymore. |
I renamed the title to try to encompass the true error, but please feel free to change it back if you prefer. |
I was able to reproduce locally. This isn't just Analytics, it's any product. I could reproduce with just Database (which doesn't support watchOS at the moment). It looks like SwiftUI previews is also trying to build any frameworks linked with the main app against the watchOS target. There may be some workarounds for source based products (making sure they're compiled out, or maybe SwiftUI previews honour It's likely worth filing a Feedback/Radar with Apple about this since the SwiftUI preview mechanism is doing something it shouldn't (as far as I'm aware). Maybe there's a need for it due to an implementation detail, but still an issue. |
Hi @ryanwilson. Thanks for researching and reproducing this. |
It looks like the SwiftUI Previews build issue is fixed in Xcode 13 Beta 1 |
I'm going to close, since there's nothing more to do here other than update to Xcode 13. |
Step 0: Are you in the right place?
[REQUIRED] Step 1: Describe your environment
[REQUIRED] Step 2: Describe the problem
After installing Firebase through SPM in a iOS project with a WatchOS target, SwiftUI previews do not work.
Xcode fails to build the scheme: "The package product 'GULAppDelegateSwizzler' requires minimum platform version 6.0 for the watchOS platform, but this target supports 2.0 (in target 'GoogleAppMeasurementTarget' from project 'GoogleAppMeasurement')"
Steps to reproduce:
Only happens in SwiftUI preview mode, the project seems to build fine when running it in DEBUG mode.
The text was updated successfully, but these errors were encountered: