IGListKit
IGListKit copied to clipboard
Improve SwiftPM support
Changes in this pull request
Improve SwiftPM support:
Build module IGListDiffKit and IGListKit as Objective-C++.
module IGListDiffKit:
- Source/IGListDiffKit
- module defined in Source/IGListDiffKit/modulemap/module.modulemap
- requires -fmodules and -fcxx-modules
module IGListKit:
- depend on IGListDiffKit, use @import IGListDiffKit;
- Source/IGListKit
- module defined in Source/IGListKit/modulemap/module.modulemap
- requires -fmodules and -fcxx-modules
module IGListSwiftKit:
- depend on IGListKit, use import IGListKit
- Source/IGListSwiftKit
Deleted spm/ and scripts/generate_spm_sources_layout.sh, it is unnecessary.
Updated .podspec, add 'OTHER_CFLAGS' => '-fmodules' and 'OTHER_CPLUSPLUSFLAGS' => '-fcxx-modules'.
Add missing swift files for IGListSwiftKit in IGListKit.xcodeproj
How to use
Replace #import <IGListDiffKit/IGListDiffKit.h> with @import IGListDiffKit;, because IGListDiffKit.h isn't exist in modulemap/, Or create a symbol link by ln -sf ../IGListDiffKit.h for support it ?
Examples
Use SwiftPM for building examples.
Checklist
- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [ ] I added an entry to the
CHANGELOG.mdfor any breaking changes, enhancements, or bug fixes. - [x] I have reviewed the contributing guide
wow, this change is awesome that we removed the need to use spm/ folder and the generation script. I would love to get @3a4oT to take a look as well since he worked on this bigger change before in https://github.com/Instagram/IGListKit/pull/1487 At the same time, I can try importing into the repo and see if anything failed.
@lorixx has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@TimOliver has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@TimOliver has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@TimOliver merged this pull request in Instagram/IGListKit@c9e045c9425a160871a7915260d07a6c273b548d.
Hi @cntrump! I'm so sorry for the amount of time it took for us to get back to you on this!
Thanks a lot for the amazing PR! I've been playing with it internally and as a fork on my personal GitHub.
I did have to modify it and roll back some of your changes though. As awesome as being able to configure SPM without having to use symlink references to every file is, it unfortunately didn't work when I tested it without using modular imports. I think this might be related to the fact that SPM is really strict on searching for headers outside of a target's directory, and we're relying on certain IGListDiffKit internal headers to build IGListKit.
Hopefully as SPM improves, we can explore this again in the future. Thanks again!