如何使用Swift Package Manager将第3方框架作为依赖项导入?

时间:2019-06-12 18:44:05

标签: swift package

我正在尝试使用Swift Package Manager创建一个项目,但是在尝试包含Fabric.framework时遇到了问题。

这是我的Package.swift

let package = Package(
    name: "TestPackage",
    platforms: [
        .iOS(.v10), .macOS(.v10_12)
    ],
    products: [
        // Products define the executables and libraries produced by a package, and make them visible to other packages.
        .library(
            name: "TestPackage",
            targets: ["TestPackageSwift", "TestPackageObjC"]),
    ],
    dependencies: [        
        .package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.8.2"),
        .package(path: "./TestPackage/Libraries/Fabric.framework"),
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages which this package depends on.
        .target(
            name: "TestPackageSwift",
            dependencies: ["Alamofire", "Fabric"],
            path:"./TestPackage/Sources/Swift"),
        .target(
            name: "TestPackageObjC",
            dependencies: ["Fabric"],
            path:"./TestPackage/Sources/ObjC"),
        .testTarget(
            name: "TestPackageTests",
            dependencies: ["TestPackageSwift", "TestPackageObjC"],
            path:"./TestPackageTests/Sources"),
    ]
)

这是我得到的错误:

error: ./TestPackage/Libraries/Fabric.framework has no Package.swift manifest

这有可能吗?

感谢您的帮助!

0 个答案:

没有答案