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

Add watchOS as a supported destination #1438

Merged
merged 4 commits into from
Feb 13, 2024

Conversation

tatsuky
Copy link
Contributor

@tatsuky tatsuky commented Jan 23, 2024

Hi, I'm new to this project. This PR adds the watchOS support for the supportedDestinations configuration, initially added in #1336.

Changes

  • Added the watchOS case to the SupportedDestination enum.
  • Added a configuration template for watchOS.
  • Added test cases.

Tests

You can use the following example spec to verify the changes.

name: MyProject
options:
  bundleIdPrefix: com.myapp
targets:
  MyWatchKitApp:
    type: application
    platform: watchOS
    sources: [MyWatchKitApp]
    settings:
      MARKETING_VERSION: 1
      CURRENT_PROJECT_VERSION: 1
    dependencies:
      - target: MyFramework
    info:
      path: MyWatchKitApp/Info.plist
      properties:
        WKCompanionAppBundleIdentifier: com.myapp
        WKApplication: true
  MyFramework:
    type: framework
    supportedDestinations: [iOS, watchOS]
    platform: iOS
    sources: [MyFramework]
    settings:
      GENERATE_INFOPLIST_FILE: YES

Thanks.

Comment on lines 46 to 47
case .watchOS:
return 5
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @yonaskolb and @amatig,
I'm wondering why the priorities are currently in this order and where watchOS should be. Any thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding test cases helped me realize this - TARGETED_DEVICE_FAMILY and SUPPORTED_PLATFORMS are ordered based on this priority. watchOS is 4, meaning it needs to be between tvOS (3) and visionOS (7).

Copy link
Collaborator

@giginet giginet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great contribution! I wished this feature 💯

I'll test this feature for my use case.

@@ -484,7 +484,33 @@ class ProjectGeneratorTests: XCTestCase {
try expect(targetConfig1.buildSettings["ASSETCATALOG_COMPILER_APPICON_NAME"] as? String) == "AppIcon"
try expect(targetConfig1.buildSettings["CODE_SIGN_IDENTITY"] as? String) == "iPhone Developer"
}


$0.it("supportedDestinations merges settings - iOS, watchOS") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests can be parameterized tests to reduce redundancy.

But it's better existing test cases also become parameterized tests.
So I think it's good at this time.

Copy link
Owner

@yonaskolb yonaskolb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @tatsuky

@yonaskolb yonaskolb merged commit 6bbf2c6 into yonaskolb:master Feb 13, 2024
2 checks passed
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.

5 participants