DATE:
AUTHOR:
PowerSync Product Team
Swift SDK

Beta Release of the PowerSync Swift SDK

DATE:
AUTHOR: PowerSync Product Team

We are excited to announce the Beta release of our Swift SDK. This release marks a significant step towards a fully native Swift experience.

With this release, the SDK is now production-ready for developers who have thoroughly tested their use cases. We've made substantial improvements to address the challenges encountered in our initial Alpha version.

Journey to a Native Swift SDK

Our Alpha version of the Swift SDK was originally generated using our Kotlin Multiplatform SDK, with SKIE and KMMBridge for interoperability. However, this approach revealed several challenges, including:

  • Typing Issues: Kotlin’s typing system does not map well to Swift, which led to poor type safety and requiring workarounds in Swift code.

  • Kotlin Functionality Exposed: Swift developers were forced to navigate Kotlin-specific types and paradigms, which wasn't intuitive.

  • Performance Limitations: Threading constraints required all transactions to run on the main thread, impacting application performance.

Due to these issues, we've decided to migrate the Swift SDK from this Kotlin-based architecture to a fully native Swift solution.

Beta Release Improvements

This Beta release introduces a Swift-native wrapper around the Kotlin Multiplatform SDK. This delivers a more intuitive, Swift-friendly interface with improved type-safety. Other challenges were also addressed, such as introducing multi-threading support for transactions. Read more about these updates in the Notable Changes in the Beta section below.

Stable Release

For the future Stable release, we plan to remove the internal KMP dependency and completely rewrite the SDK in pure Swift. This transition will further enhance both the developer experience and performance by also fully utilizing Swift's native features and libraries. To ensure a seamless upgrade, we aim to retain the APIs introduced in the Beta, avoiding any breaking changes for users.

Notable Changes in the Beta

  • Swift Package Wrapper: Introduced a new Swift Package that provides a more Swift-native interface for developers:

    • Exposed Swift-native classes, structs, and types for improved developer experience.

    • Implemented support for default arguments.

  • Type Mapping Enhancements: Improved type-safety by resolving generic type mapping issues between Kotlin and Swift.

  • Multi-threading Support: Transactions can now be executed off the main thread, boosting performance.

  • Swift Package Manager (SPM) Support: The powersync-sqlite-core package is now available on SPM, simplifying installation and eliminating the need for CocoaPods.

  • Independent Release Cycle: Swift SDK releases are now decoupled from Kotlin SDK deployments, enabling updates tailored specifically for Swift developers.

    • An independent Changelog for the Swift SDK is now available here.

Get Started

New to PowerSync Swift?

We recommend the Supabase Todo List Demo app as a starting point to using the Swift SDK. See its README for instructions to run it.

Migrating from the Alpha

If you are migrating from the Alpha version of the SDK, see these developer notes.

SDK Reference

The Swift SDK reference is available here and includes installation instructions and code snippets.

Need help / have feedback?

If you need any help getting started or have any questions, chat with us on Discord. We'd also love to hear your feedback!

Powered by LaunchNotes