Skip to content

Fix watchOS target detection and add isWatchExtension helper#42

Merged
EvanBacon merged 2 commits intomainfrom
@evanbacon/watchos-fixes
Feb 28, 2026
Merged

Fix watchOS target detection and add isWatchExtension helper#42
EvanBacon merged 2 commits intomainfrom
@evanbacon/watchos-fixes

Conversation

@EvanBacon
Copy link
Owner

Summary

  • Fix isWatchOSTarget(): Changed from checking com.apple.product-type.application + WATCHOS_DEPLOYMENT_TARGET to checking the proper watchOS product types (watchapp, watchapp2, watchapp2-container)
  • Fix getCopyBuildPhaseForTarget(): Was incorrectly returning "Embed Watch Content" for any regular iOS app; now uses isWatchOSTarget()
  • Add isWatchExtension(): New helper method to identify watch extension targets (watchkit-extension, watchkit2-extension)

Test plan

  • All existing tests pass
  • Added tests for isWatchExtension()
  • Updated tests to use correct watchOS product types
  • Verified against XcodeProj Swift library patterns

🤖 Generated with Claude Code

EvanBacon and others added 2 commits February 27, 2026 20:45
Change PBXNativeTarget.isWatchOSTarget to identify watchOS targets based on productType (watchapp, watchapp2, watchapp2-container) instead of relying on the WATCHOS_DEPLOYMENT_TARGET build setting. Update tests to find and assert watchapp2 targets, add explicit tests for watchapp and watchapp2-container targets, and adjust expectations for regular application targets (setting WATCHOS_DEPLOYMENT_TARGET no longer makes them watchOS targets). This simplifies detection logic and aligns behavior with product type identifiers.
- Fix getCopyBuildPhaseForTarget to use isWatchOSTarget() instead of checking for generic application type
- Add isWatchExtension() helper for watchkit-extension and watchkit2-extension product types
- Update tests to use correct watchOS product types

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@EvanBacon EvanBacon merged commit 41278c4 into main Feb 28, 2026
1 check passed
@EvanBacon EvanBacon deleted the @evanbacon/watchos-fixes branch February 28, 2026 04:56
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.

1 participant