Adds Support for Swift Package Manager#208
Conversation
rolandleth
left a comment
There was a problem hiding this comment.
Thank you for the contribution! Just a few changes to be made, please.
Also, could you please explain a bit the need for the LTHPasscodeViewControllerStrings change? Haven't worked with SPM yet, so no idea what the issue was and how it got solved.
|
The reason I needed to change the LTHPasscodeViewControllerStrings was due to how the new SPM tooling processes resources. Basically it compiles them into a bundle and exposes that bundle to Swift and Objc. I gathered most of my information on what that looks like from this article: https://darjeelingsteve.com/articles/How-to-Use-Module-Resources-in-Objective-C-SPM-Packages.html |
|
Thanks for sharing the article! Hmm, is there any way to test the package before merging? Can I add it to a project by entering the URL of your |
Yes! You can simply add https://github.com/SimpleNexus/LTHPasscodeViewController as the git source, then on the rules page, just select branch and point it at dev as seen in the picture below: |
|
Cool, I'll give it a go today, thanks! |
|
Hey! Very sorry for the long delay, but I managed to give it a go today. I added the package to a Swift project and everything works, except localization. Maybe I'm not doing it properly, but I set the project to use English and German, I added a Either I'm doing something wrong, or the macro isn't working properly 🤔🤔 Can you get localization to work when using the passcode as a package? The demo project is properly localized. |
|
@rolandleth Sorry for the delay, got distracted for a quick....8 months haha. However, I updated the code to work with localization (nice catch by the way). There was an issue where I was looking in the wrong bundle. The last two commits fix that. Let me know if there are any other issues. |
I was testing localization and set the Touch ID string as the value for the string to use. I have since removed this and use the key parameter instead
|
@jaerod95 This has to be the slowest moving PR in history 🙈 I tested it and it works, I think it's good to merge, thank you! |

Adds support for SPM. See README.md for instructions on how to add it to your project.
Finally got around to fixing this up again. Now that Apple supports Resources I was able to import the Localizations. I added to the LTHPasscodeViewControllerStrings method to search for the SPM bundle if it didn't find a localized string since Apple moves those localizations into its own bundle.