Open dreampiggy opened 4 years ago
SPM isn't supported (https://github.com/Instagram/IGListKit/issues/1368).
Any idea when it can be added? @lorixx :)
@danqing For SwiftPM on Objective-C, it's a pain because SwiftPM design assume using the raw C style for include
public headers, however:
Object.h/Object.m
in the same directory, not a standalone include
directory for public headers. Tha's a suck for treating Objective-C the same as C.If you want to supports SwiftPM, you can checkout what SDWebImage do, which have also two Target (one SDWebImage
and another SDWebImageMapKit
). Which use the custom header search path to achieve this, and also have to hide the Private Headers
(I previouslly think facebook guys already solve this problem, but actually not)
@dreampiggy I note that SDWebImage use #import ".h"
to import its file. And I try that way on IGListKit and write the Package.swift, it works. So Is that what you mean above you said?
@Bruce-pac Use both
@import IGListKit;
import IGListKit
cause the compile error showed in the first screenshot. You can have a check again at 4.0.0 version via SwiftPM.
@dreampiggy yeah, a big reason of that is that the Package.swift manifest file is not right. I'm trying rewrite Package.swift file.
I note that SDWebImage use #import ".h"
to import its file in its other file. such as this:
#import "SDAnimatedImage.h"
#import "NSImage+Compatibility.h"
#import "SDImageCoder.h"
#import "SDImageCodersManager.h"
#import "SDImageFrame.h"
#import "UIImage+MemoryCacheCost.h"
#import "SDImageAssetManager.h"
However, IGListKit use #import <A/B.h>
to import its file in its other file.
The modified file like:
// swift-tools-version:5.1
import PackageDescription
let package = Package(name: "IGListKit",
platforms: [
.macOS(.v10_11),
.iOS(.v9),
.tvOS(.v9)
],
products: [
// .library(name: "IGListKit", targets: ["IGListKit"]),
.library(name: "IGListDiffKit", targets: ["IGListDiffKit"])
],
dependencies: [],
targets: [.target(name: "IGListDiffKit",
dependencies: [],
path: nil,
sources: nil,
publicHeadersPath: "Source/IGListDiffKit/Public",
cSettings: [
.headerSearchPath("Public"),
.headerSearchPath("Internal"),
],
linkerSettings: [
.linkedLibrary("libc++"),
]
),
// .target(name: "IGListKit",
// dependencies: ["IGListDiffKit"],
// path: ".",
// sources: ["Source/IGListKit"],
// publicHeadersPath: "include/IGListKit",
// cSettings: [
// .headerSearchPath("Source/IGListKit"),
// .headerSearchPath("Source/IGListKit/Internal"),
// .headerSearchPath(".")
// ],
// linkerSettings: [
// .linkedLibrary("libc++"),
// ]
// )
],
cxxLanguageStandard: .cxx11)
If I modify the import style to #import ".h"
, IGListDiffKit can compile success, but the original import style #import <A/B.h>
cause the compile error showed in the first screenshot.
So I guess this issue maybe has two solutions, one is like SDWebImage, other is like CocoaLumberjack.
If you use #import <A/B.h>
. You must have public header search path, pointer to A
's parent directory.
SwiftPM for C/ObjC, only support one public header directory, and does not have module umbrella header like CocoaPods/Carthage (it use a Umbrella Directory
, see: https://clang.llvm.org/docs/Modules.html#umbrella-directory-declaration)
For example, move the source code's header, as this strcture
- Source <---- Public Header Directory
-- IGListKit
--- IGListAdapter.h
So the SwiftPM can search this with <IGListKit/IGListAdapter.h>
Do you have an ETA on when this is gonna be released? @Bruce-pac @dreampiggy
spm sucks, i stick with cocoapods
OMG I had exact issue that @Bruce-pac experienced before: https://github.com/Instagram/IGListKit/issues/1368#issuecomment-696529398 this is what I am trying, maybe we cannot go around the Apple's setting to require "XXX.h" format instead of <Library/XXX>h> format here.
@dreampiggy interesting, I actually tried it out but I am not able to successfully build the project still.
I'm not the maintainer of IGListKit. I'm the maintainer of SDWebImge.
You can try to see how we use symbol link the header to keep the same import syntax of #import <SDWebImage/SDWebImage.h>
across all these Package Managers:
https://github.com/SDWebImage/SDWebImage/pull/2987
Though I think these massive crazy Package Managers (first Carthage) may disappear after some years of adopting SwiftPM.
Some work in progress #1465
any updates on this?
New issue checklist
README
and documentationGeneral information
IGListKit
version: 4.0.0Debug information
Just two screenshots, enough to say the issues...