[SwiftPM] Fix Localizations when using SPM #422
Merged
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.
In Xcode 12 and Swift 5.3, Apple added the ability for Swift Packages to contain resources. This is required to support localizations and NIB's and other common bundle resources.
In this PR I modified the Package.swift to include the localizations and added some code to load the new (strange) way of loading the SwiftPM compiled bundle.
Some resources that are helpful for understanding the changes:
Note: that there is supposed to be easier support for finding the bundle in Objective-C with the
#define
SWIFTPM_MODULE_BUNDLE
but I could not figure out how to make the.h
file find this. It is compiled and put there as a build product but I couldn't figure out how to make the.h
file find this. So I had to build it manually looking at the implementation provided by Apple.Also Note: that this will break SPM support in Xcode 11 and lower. This is probably for the best as TOCropViewController compiled with in Xcode 11 with SPM will not be localized and will degrade user experience if a developer ships this and does not realize it.