-
Notifications
You must be signed in to change notification settings - Fork 123
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 support #648
Merged
Merged
Add WatchOS support #648
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
we need also to define watchos64 and watchos32 intermediate source set because some apple api are different on 64 and 32 bit architecture (watchosArm64 target is actually arm64_32, which is a variant of arm64 with 32-bit pointer sizes, used on Apple Watch Series 4 and later.)
expected classes: - FontResource - ImageResource expected methods: - ColorDesc.getUIColor(): UIColor - ColorResource.getUIColor() - ResourceContainer<ImageResource>.getImageByFileName(fileName: String): ImageResource? Some classes / methods needed some changes due to some api not being available on watchos. e.g. ImageResource could not get UIImage from specific bundle e.g. FontResource needed different implementation for watchos64 and watchos32 due to different pointer size.
added also a watchos app target in kotlin-ios-app sample project
sample app gives the following error if configuration cache is enabled: error: Build input file cannot be found: '<USER_PATH>/Build/Products/Debug-iphonesimulator/TestKotlinApp.app/TestKotlinApp'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?
@FabioCornelli Hi, can u check latest commits on watchOs? I'm merge latest version of branch, change FontResource with latest version of Apple variant FontResource. Thank you |
Alex009
requested changes
Apr 17, 2024
resources-build-logic/src/main/kotlin/apple-main-convention.gradle.kts
Outdated
Show resolved
Hide resolved
Alex009
requested changes
Apr 18, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conflict should be resolved
# Conflicts: # resources/src/appleMain/kotlin/dev/icerock/moko/resources/FontResource.kt
# Conflicts: # resources/src/appleMain/kotlin/dev/icerock/moko/resources/NSErrorException.kt
11 tasks
Alex009
approved these changes
Apr 19, 2024
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, we are using moko-resources in our KMP mobile app (iOS & Android) mostly for strings localization and is working great!
Recently, we were asked to try to extend part of our application on watchOS and we found out that moko-resources does not target watchOS (see #74 )
So with these PR I've tried to add watchOS targets to moko-resources project.
Most of the code of "resources" project was already written in "appleMain" source set, so it was already compatible also on watchOS.
The "resources-generator" plugin code was also already generating .strings file correctly for watchOS targets.
So in this PR I've basically done the following:
I've run the sample on watchOS simulator and it seems to work correctly.
There a couple of things that i think can be improved:
internal expect fun Color.toUIColor(): UIColor
should probably be moved in "moko-graphics" library. Shall I open a PR on moko-graphics ? if so, it's probably better to have a version of "moko-graphics" that support watchOS before moving on this PR.If somebody has a better idea on how watchOS target can be tested, I'm open for suggestions and feedback.
Finally, with this PR I'm targeting #575 branch instead of develop because I've read in #624 that in #575 the plugin was rewritten.
Please let me know if that is correct or i should point to a different branch.