Skip to content
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

Fix watchOS preview build issue #380

Merged
merged 18 commits into from
Oct 27, 2023

Conversation

sergeirr
Copy link
Contributor

@sergeirr sergeirr commented Oct 25, 2023

For some reason Xcode watchOS SwiftUI preview attempts to build this package against watchOS SDK.
Fixed by adding os type check.
Tested with:

  • iOS Preview
  • watchOS Preview
  • iOS build
  • watchOS build

Fixes #111

Added os type check to all files
@sergeirr
Copy link
Contributor Author

sergeirr commented Oct 25, 2023

Additional description: https://developer.apple.com/forums/thread/731732

@davdroman
Copy link
Collaborator

Thanks for your PR.

Is there any way we could add a CI check to make sure this doesn't break with future iterations?

@sergeirr
Copy link
Contributor Author

I'm not sure about this. I don't know if it is possible to "Build to Preview" from the command line to reproduce the problem.

@davdroman
Copy link
Collaborator

Okay I'll look into this. I wouldn't want to merge without some assurance from CI. I'll try my best to get it sorted asap.

@sergeirr
Copy link
Contributor Author

I see.
Another workaround for developers is to temporary remove the iOS main app target from the watchOS scheme when you want to work with watchOS SwiftUI Previews.
image

@sergeirr
Copy link
Contributor Author

@davdroman You can mention me if you need some help with an example project to reproduce this.

@davdroman
Copy link
Collaborator

@sergeirr yes please, I'd certainly appreciate an example project.

@sergeirr
Copy link
Contributor Author

@davdroman This is the project https://github.com/sergeirr/WatchOSIntrospect
There are 2 branches (excluding main):

  1. With issue (added origin SwiftUIIntrospect package)
  2. Without issue (added forked by me SwiftUIIntrospect package)

@davdroman
Copy link
Collaborator

Thanks! This is very helpful to get going.

@davdroman davdroman changed the title Fixed watchOS preview build issue Fix watchOS preview build issue Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cannot find type 'PlatformView' in scope
2 participants