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

Apple Watch devices support #88

Merged
merged 6 commits into from Sep 26, 2023
Merged

Apple Watch devices support #88

merged 6 commits into from Sep 26, 2023

Conversation

vincentneo
Copy link
Collaborator

@vincentneo vincentneo commented Jan 30, 2023

Hey @Nirma,

Recently needed something like UIDeviceComplete but for the Apple Watch, so I wrote this.

I've added a bunch of code for a separate target in the Xcode project, called WKDeviceComplete.
Currently:

  • Unsure how to package for SPM, CocoaPods, etc
  • Tests

But otherwise, the code does work. Only System.swift is shared.

Usage wise, it's pretty similar:

WKInterfaceDevice.current().dc.commonDeviceName // Apple Watch Series 7, 45mm case (GPS + Cellular)
WKInterfaceDevice.current().dc.deviceModel // DeviceModel.series7
WKInterfaceDevice.current().dc.screenSize?.caseSize // 45 

I'm unsure if this should belong as a fork of UIDeviceComplete instead (because of SPM, etc). What do you think?

@Nirma
Copy link
Owner

Nirma commented Feb 5, 2023

@vincentneo I am so sorry for replying late! Yes lets add in watchOS support.

I think we can add a watchOS target for both SPM and CocoaPods and use symlinks to smooth out any rough edges.
Let me look into this later today and try something.

For now this looks good, let me update the CI settings.

By the way what are you concerned with on this point?

I'm unsure if this should belong as a fork of UIDeviceComplete instead (because of SPM, etc)

@vincentneo
Copy link
Collaborator Author

By the way what are you concerned with on this point?

Tried adding in another Package.swift (since the watch codes are on separate directories), doesn't seem to work. So my only concern is that it couldn't be packaged correctly that's all!

@vincentneo
Copy link
Collaborator Author

Thinking it through, maybe we can just throw a bunch of #if os(watchOS) everywhere, and SPM should work properly?

@vincentneo
Copy link
Collaborator Author

Thinking it through, maybe we can just throw a bunch of #if os(watchOS) everywhere, and SPM should work properly?

Have implemented this. Code now looks like a mess, but (1) it works fine (tested on simulator), (2) SPM easily cooperates with this.

@Nirma What do you think about this? Wish to hear some thoughts on this, before I write the test cases.

@Nirma
Copy link
Owner

Nirma commented Sep 19, 2023

@vincentneo Yes, it looks fine to me. Lets roll with it.

@vincentneo
Copy link
Collaborator Author

Have written the tests, let me know if I missed out on something, thanks!

@Nirma
Copy link
Owner

Nirma commented Sep 26, 2023

@vincentneo LGTM!

@Nirma Nirma merged commit 7f2d9f5 into main Sep 26, 2023
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.

None yet

2 participants