Skip to content

powersync-ja/powersync-swift

Repository files navigation

PowerSync is a sync engine for building local-first apps with instantly-responsive UI/UX and simplified state transfer. Syncs between SQLite on the client-side and Postgres, MongoDB or MySQL on the server-side.

PowerSync Swift

This is the PowerSync SDK for Swift clients. The SDK reference is available here, API references are documented here.

Structure: Packages

  • Sources

    • This is the Swift SDK implementation.

Demo Apps / Example Projects

The easiest way to test the PowerSync Swift SDK is to run our demo application.

  • Demo/PowerSyncExample: A simple to-do list application demonstrating the use of the PowerSync Swift SDK using a Supabase connector.

Installation

Add

    dependencies: [
        ...
        .package(url: "https://github.com/powersync-ja/powersync-swift", from: "1.0.0")
    ],
    targets: [
        .target(
            name: "YourTargetName",
            dependencies: [
                ...
                .product(
                    name: "PowerSync",
                    package: "powersync-swift"
                ),
            ]
        )
    ]

to your Package.swift file.

Usage

Create a PowerSync client

import PowerSync

let powersync = PowerSyncDatabase(
    schema: Schema(
        tables: [
            Table(
                name: "users",
                columns: [
                    .text("count"),
                    .integer("is_active"),
                    .real("weight"),
                    .text("description")
                ]
            )
        ]
    ),
    logger: DefaultLogger(minSeverity: .debug)
)

Underlying Kotlin Dependency

The PowerSync Swift SDK makes use of the PowerSync Kotlin Multiplatform SDK and the API tool SKIE under the hood to implement the Swift package. However, this dependency is resolved internally and all public APIs are written entirely in Swift.

For more details, see the Swift SDK reference and generated API references.

Attachments

See the attachments README for more information.

About

SDK that enables local-first and real-time reactive apps with embedded SQLite for Swift clients

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 6

Languages