mxcl / PromiseKit

Promises for Swift & ObjC.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot use PromiseKit as a dependency in a Swift Package

cbauer10 opened this issue · comments

  • Using the version 6 of PromiseKit
  • Trying to use PromiseKit as a dependency in another SwiftPackage so installing as SwiftPM

Here is my Package.swift file:

// swift-tools-version:5.7

import PackageDescription

let package = Package(
    name: "Networking",
    platforms: [.iOS(.v11), .macOS(.v10_13)],
    products: [
        .library(name: "Networking", targets: ["Networking"])
    ],
    dependencies: [
        .package(url: "https://github.com/mxcl/PromiseKit", .upToNextMajor(from: "6.0.0"))
    ],
    targets: [
        .target(name: "Networking", dependencies: ["PromiseKit"]),
        .testTarget(name: "Networking-UnitTests", dependencies: ["Networking"])
    ]
)

It doesn't seem to include CorePromise, Foundation, or UIKit like CocoaPods does. Am I missing some step to get all of the classes. I am getting Not is scope errors on almost all of the classes.

I can't help if you don't include the error message.

Sorry, I thought it was clear, but I will give a specific class that is giving an issue:

Cannot find type 'PNKHTTPError' in scope

If you want to use the Foundation extensions you have to explicitly add them in your Package.swift.

https://github.com/PromiseKit/Foundation#swiftpm

Thank you very much. I had figured out that Foundation was missing, but there was no documentation about it here, so I was having trouble locating it.

Big opportunity for consistency here however.

  • PMKFoundation is not named the same for CocoaPods and SwiftPM
  • PMKFoundation is included in the standard CocoaPods spec and not in the SwiftPM package

PMKFoundation is not named the same for CocoaPods and SwiftPM

Namespacing issues forced this and it cannot be fixed now without breaking 10,000 installs.

PMKFoundation is included in the standard CocoaPods spec and not in the SwiftPM package

It is impossible to bundle extra packages with SwiftPM.

Thank you very much. I had figured out that Foundation was missing, but there was no documentation about it here

There is copious documentation about this in more than 4 places. Thanks.