MatthewYork / DateTools

Dates and times made easy in iOS
MIT License
7.22k stars 952 forks source link

Add support for SwiftPM #291

Closed maniramezan closed 4 years ago

maniramezan commented 4 years ago

This PR is adding support for SwiftPM. At the moment, the tests compile, but crashes when you run due to DateTools.bundle not being in the final bundle. Adding resources file to swiftpm has been recently added in SE-0271, but at the time of submitting this PR, it's not included in any available Swift snapshots or Xcode11.4b1 version. When it lands in public, the tests can be fixed also in addition to adding DateTools.bundle as a resource. This is similar to https://github.com/MatthewYork/DateTools/pull/285 PR.

Just note that for using SwiftPM at the moment, developers need to add DateTools.bundle manually to their codebase. Might worth to also update Readme file to mention SwiftPM integration and the necessity of adding the bundle file.

MatthewYork commented 4 years ago

I will get this reviewed and merged first thing tomorrow! Just want to run through some of the tests since it looks like they have changed.

Also, I’m not up to date on SPM... do I need to advertise/list it anywhere? Thanks!

maniramezan commented 4 years ago

IMO it should be mentioned in Readme file as part of installation and emphasize on including bundle manually until adding resource capability is available in SwiftPM. Especially because it causes a crash if you don’t and use any of the APIs using the localization.

MatthewYork commented 4 years ago

Haven't forgotten about you! Had a few things come up at work, so might be closer to the weekend.

maniramezan commented 4 years ago

No hurries, whenever you get to it, let me know if you had any questions. I’m still waiting for new Xcode11.4 beta to comes out to see if it’ll include resource changes.

tgymnich commented 4 years ago

any updates on this?

maniramezan commented 4 years ago

You can use master branch from my fork if you need this. Just be sure to manually add the bundle. I'm going to open another PR which uses 5.3 tolls which can handle resources so this won't be necessary.

maniramezan commented 4 years ago

For future reference, https://github.com/maniramezan/DateTools/tree/mani_swiftpm_5_3 contains the work for using SwiftPM 5.3 tooling which supports resources. For now, that branch breaks cocoapods and Carthage integrations due to lack of support for Bundle.module in those versions. Will wait on a few more betas to see if there'd be a fix or a recommended way to solve this issue.

maniramezan commented 4 years ago

Closing this in favor of https://github.com/MatthewYork/DateTools/pull/294