I added .package(url: "https://github.com/vapor-community/postgresql-provider.git", .upToNextMajor(from: "2.1.0")) to my Package.swift file, ran vapor update and let it regenerate the Xcode project. When I then add the import of PostgreSQLProvider Xcode can't find it. I already have postgresql and pkg-config installed via homebrew.
I'm using Xcode 9 and Swift 4
Looks like you are using the Swift 4 package manager. The API for it was updated so you have to explicitly add the dependency to the target:
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "Project",
products: [
.library(name: "App", targets: ["App"]),
.executable(name: "Run", targets: ["Run"])
],
dependencies: [
.package(url: "https://github.com/vapor/vapor.git", .upToNextMajor(from: "2.1.0")),
.package(url: "https://github.com/vapor/fluent-provider.git", .upToNextMajor(from: "1.2.0")),
.package(url: "https://github.com/vapor-community/postgresql-provider.git", .exact("2.1.0"))
],
targets: [
.target(name: "App", dependencies: ["Vapor", "FluentProvider", "PostgreSQLProvider"],
exclude: [
"Config",
"Public",
"Resources",
]),
.target(name: "Run", dependencies: ["App"]),
.testTarget(name: "AppTests", dependencies: ["App", "Testing"])
]
)
See above, I added the PostgreSQLProvider package to dependencies array for App target.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With