skip to Main Content
// swift-tools-version:5.5
import PackageDescription
    
let package = Package(
    name: "PKG",
    platforms: [.iOS(.v15)],
    products: [
        .library(name: "Lib1", targets: ["Lib1"]),
        .library(name: "Lib2", targets: ["Lib2"]),
        .library(name: "Lib3", targets: ["Lib3"]),
    ],
    dependencies: [
    ],
    targets: [
        .target(name: "Lib1", dependencies: []),
        .target(name: "Lib2", dependencies: []),
        .target(name: "Lib3", dependencies: []),
    ]
)

I’m creating a package with multiple products, I uploaded it to github to use it in SPM in my project,

It’s letting me select the libraries I want to add to my project which is what I want, but no matter what I select it bring all the libraries and it’s files to my project is this how it works? or can I make it download only the selected libraries and it’s dependencies only?

thank you

2

Answers


  1. In SPM or swift package manager you can install any libraries that you want for example in install Fire base you may do not need to another libraries, because this framework has a lot libraries.

    I use SPM also 🙂

    Login or Signup to reply.
  2. Unfortunately, SPM will always download the complete repository containing the package/sub-package. You can try out that behaviour at any major library with several products, such as firebase (also note that supporting code such as demo applications and tests will be included in the download as well).

    For more information, please see this discussion at swift.org.

    The workaround is to split your library into several repositories or use another dependency manager, such as cocoapods which fully supports that feature.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search