feat: Capacitor SPM#973
Conversation
🦋 Changeset detectedLatest commit: 84381ab The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Out of curiosity, how are SPM dev releases kicked off from the Capacitor package? And have we tested an SPM based dev release? |
That's a good question... We don't actually publish a Swift repo for SPM usage. This adds support with Capacitor's SPM integration. Capacitor will configure an application to use SPM and link the relevant plugins (like our Capacitor plugin). The linking process usually involves linking the
// DO NOT MODIFY THIS FILE - managed by Capacitor CLI commands
let package = Package(
name: "CapApp-SPM",
platforms: [.iOS(.v15)],
products: [
.library(
name: "CapApp-SPM",
targets: ["CapApp-SPM"])
],
dependencies: [
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", exact: "8.3.4"),
.package(name: "CapacitorCommunitySqlite", path: "../../../node_modules/.pnpm/@capacitor-community+sqlite@8.1.0_@capacitor+core@8.3.4/node_modules/@capacitor-community/sqlite"),
.package(name: "CapacitorSplashScreen", path: "../../../node_modules/.pnpm/@capacitor+splash-screen@8.0.1_@capacitor+core@8.3.4/node_modules/@capacitor/splash-screen"),
.package(name: "PowersyncCapacitor", path: "../../../node_modules/@powersync/capacitor")
],I haven't tested an explicit dev release, but I have confirmed that our |
I see where my confusion stemmed from. That's neat! Thanks. |
|
I verified that using a dev version of these changes in our |
Overview
Capacitor 6 added support for SPM in iOS builds. The default package manager was still set to Cocoapods till version 8, where SPM became the default.
The PowerSync Capacitor SDK exports a Capacitor plugin which registers the PowerSync SQLite core extension as a SQLite auto extension using the C
sqlite3_auto_extensionfunction. This method allows us to register the PowerSync core extension behind@capacitor-community/sqlite's back - since it does not provide a direct method of loading SQLite extensions.Our Capacitor plugin currently only supports a Cocoapod integration - it thus only works on Capacitor iOS projects which use Cocoapods as the package manager.
This PR adds support for SPM to our PowerSync Capacitor plugin. This causes a chain of requirements and events to unfold.
capacitorrequirement of Capacitor 8Details
PowerSync Capacitor
The PowerSync Capacitor plugin's Capacitor dependencies have been bumped to version 8. A
Package.swiftfile has been added as the entry point for SPM. Some of the low level C header imports have been updated in order to be compatible with a SPM build environment.Example Capacitor
The
example-capacitordemo has been upgraded to version 8 by following the guide. I verified both Android and iOS were functioning normally.Internal Testing Example
The norm for Capacitor plugins is to have a small
example-appinside the package which is used to run compilation tasks during development, e.g. theverify:iosscript which ensures the plugin compiles with XCode. I've updated this to Capacitor 8 as well.Minimum Targets
As mentioned in the Capacitor docs. Upgrading to Capacitor 8 raises the minimum iOS to
iOS 15.0.Android's minimum isminSdkVersion = 24Product Visibility
I've added the
Product Visibilitylabel since this drops support for older Capacitor versions.TODOs