4

I want to know if there is anyway to link a swift package against a framework like SQLite.framework in Xcode? I'm trying to make a swift package for a sqlite library wrapper.

Here is my current swift package manifest:

// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "SQLiteDB",
    products: [
        // Products define the executables and libraries produced by a package, and make them visible to other packages.
        .library(
            name: "SQLiteDB",
            targets: ["SQLiteDB"]),
    ],
    dependencies: [

        // .package(url: /* package url */, from: "1.0.0"),
    ],
    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: "SQLiteDB",
            dependencies: []),
        .testTarget(
            name: "SQLiteDBTests",
            dependencies: ["SQLiteDB"]),
    ]
)
2
  • Since there are several Sqlite wrappers for Swift on GitHub it must be possible, maybe take a look at those projects to see if you can get any hints? Commented Jun 20, 2019 at 6:30
  • Only one of them github.com/stephencelis/SQLite.swift has SPM installation. I'm trying to figure it out how it is working Commented Jun 20, 2019 at 18:12

2 Answers 2

1

I ended up creating my own Sqlite package by embedding the amalgamation sources of sqlite. This gives you the ability to have any arbitrary version of Sqlite in your apps.

Sign up to request clarification or add additional context in comments.

1 Comment

How did you do this?
0

With the Xcode 12 beta, you can do this if you update your swift-tools-version to 5.3, and then add a binaryTarget to your package's targets:

.binaryTarget(
    name: "Stripe",
    url: "https://github.com/stripe/stripe-ios/releases/download/v19.3.0/Stripe.xcframework.zip",
    checksum: "fe459dd443beee5140018388fd6933e09b8787d5b473ec9c2234d75ff0d968bd"
)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.