Swift Package Manager MongoDB

I've been trying for hours just wanted some direction. I am trying to set up an app that uses a local mongo database. I've set up the IP address and everything, I'll be port forwarding for usage outside my local network. But I've been having some trouble importing mongbodb for my swift app. I keep getting this error with the package manager. If you have some tips please send them my way.
So here is the code I'm supposed to use got this from the GitHub page: https://github.com/mongodb/mongo-swift-driver

Code Block Swift
// swift-tools-version:5.1
import PackageDescription
let package = Package(
name: "MyPackage",
dependencies: [
.package(url: "https://github.com/mongodb/mongo-swift-driver.git", from: "VERSION.STRING.HERE"),
],
targets: [
// Async module
.target(name: "MyAsyncTarget", dependencies: ["MongoSwift"]),
// Sync module
.target(name: "MySyncTarget", dependencies: ["MongoSwiftSync"])
]
)

So all I did was add the version I needed and I put the latest.

Code Block Swift
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "MongoTools",
dependencies: [
.package(url: "https://github.com/mongodb/mongo-swift-driver.git", from: "1.0.1"),
],
targets: [
// Async module
.target(
name: "MyAsyncTarget",
dependencies: ["MongoSwift"]
),
// Sync module
.target(
name: "MySyncTarget",
dependencies: ["MongoSwiftSync"]
)
]
)

But now I'm getting some warnings and I can't import the library or use it. I also went into the sources folders and created appropriate folders for the modules but nothing yet. Sometimes it says I need to specify a path which I try to do but nothing's working.



Accepted Reply

MongoKitten is a much better alternative. Found the answer.

Replies

MongoKitten is a much better alternative. Found the answer.