LTHPasscodeViewController icon indicating copy to clipboard operation
LTHPasscodeViewController copied to clipboard

Adds Support for Swift Package Manager

Open jaerod95 opened this issue 4 years ago • 6 comments

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.

jaerod95 avatar Mar 27 '21 15:03 jaerod95

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

jaerod95 avatar Mar 29 '21 17:03 jaerod95

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 dev branch? Not sure what the syntax would be, maybe https://github.com/SimpleNexus/LTHPasscodeViewController/tree/dev?

rolandleth avatar Mar 29 '21 17:03 rolandleth

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 dev branch? Not sure what the syntax would be, maybe https://github.com/SimpleNexus/LTHPasscodeViewController/tree/dev?

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: Screen Shot 2021-04-08 at 10 16 45 AM

jaerod95 avatar Apr 08 '21 17:04 jaerod95

Cool, I'll give it a go today, thanks!

rolandleth avatar Apr 10 '21 05:04 rolandleth

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 Localizable.strings file, but the passcode view isn't localized.

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 avatar Apr 17 '21 09:04 rolandleth

@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.

jaerod95 avatar Dec 06 '21 16:12 jaerod95

@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!

rolandleth avatar Apr 12 '24 06:04 rolandleth