Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a .framework as dependency to a swift package in Xcode?

Tags:

xcode

swift

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"]),
    ]
)
like image 979
alizx Avatar asked Dec 07 '25 10:12

alizx


1 Answers

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.

like image 187
alizx Avatar answered Dec 09 '25 23:12

alizx