DATE:
AUTHOR:
PowerSync Product Team
Swift SDK

PowerSync Swift SDK: v1.1.0

DATE:
AUTHOR: PowerSync Product Team

We are excited to announce the Version 1.1.0 release of the PowerSync Swift client SDK

NOTE: This release contains multiple breaking changes which were implemented to enhance the Swift developer experience. See the changelog for details.

Visit the full SDK reference to get started, for implementation details, and code snippets.

See the full changelog below.

Have any questions or feedback? Chat with us and the PowerSync community on Discord.

Changelog

1.1.0

  • [ADDED] Report real-time progress information about downloads through SyncStatus.downloadProgress.

  • [ADDED] Exposed new table options allowing for more granular control over update tracking and metadata.

    • trackPreviousValues: Populates CrudEntry.previousValues, so you can see both the old and new values during an update.

    • trackMetadata: Adds a _metadata column to the table. Use this to store any custom metadata for uploads—accessible via CrudEntry.metadata.

    • ignoreEmptyUpdates: Skips generating CRUD entries when no data actually changes—reduces noise in uploadData.

1.0.0

  • This SDK is now in a stable V1 release

  • [BREAKING CHANGES]

    • Completing CRUD transactions or CRUD batches, in the PowerSyncBackendConnector uploadData handler, now has a simpler invocation.

    • index based SqlCursor getters now throw if the query result column value is nil. This is now consistent with the behaviour of named column getter operations. New getXxxxxOptional(index: index) methods are available if the query result value could be nil.

    • SqlCursor getters now directly return Swift types. getLong has been replaced with getInt64.

    • Client parameters now need to be specified with strictly typed JsonValue enums.

    • SyncStatus values now use Swift primitives for status attributes. lastSyncedAt now is of Date type.

    • crudThrottleMs and retryDelayMs in the connect method have been updated to crudThrottle and retryDelay which are now of type TimeInterval. Previously the parameters were specified in milliseconds, the TimeInterval typing now requires values to be specified in seconds.

    • throttleMs in the watched query WatchOptions has been updated to throttle which is now of type TimeInterval. Previously the parameters were specified in milliseconds, the TimeInterval typing now requires values to be specified in seconds.

    • See code snippets here for all of the above.

  • [IMPROVED] Improved the stability of watched queries. Watched queries were previously susceptible to runtime crashes if an exception was thrown in the update stream. Errors are now gracefully handled.

  • [IMPROVED] Deprecated PowerSyncCredentials userId field. This value is not used by the PowerSync service.

  • [IMPROVED] Removed references to the PowerSync Kotlin SDK from all public API protocols. Dedicated Swift protocols are now defined. These protocols align better with Swift primitives. See the BREAKING CHANGES section above for more details, and see here for the complete list of updated protocols.

  • [IMPROVED] Database and transaction/lock level query execute methods now have @discardableResult annotation.

  • [IMPROVED] Query methods' parameters typing has been updated to [Any?] from [Any]. This makes passing nil or optional values to queries easier.

  • [IMPROVED] AttachmentContext, AttachmentQueue, AttachmentService and SyncingService are are now explicitly declared as open classes, allowing them to be subclassed outside the defining module.

  • [ADDED] Added readLock and writeLock APIs. These methods allow obtaining a SQLite connection context without starting a transaction.

1.0.0-Beta.12

  • [ADDED] Introduced attachment sync helpers and a demo to showcase these. Learn how to get started here.

  • [FIXED] Cancellations in watched queries are now handled correctly.

1.0.0-Beta.11

  • [FIXED] Deadlock issue when connect() is called immediately after opening a database (introduced in 1.0.0-Beta.10).

1.0.0-Beta.10

  • [ADDED] The ability to enable custom logging. See docs here.

  • [ADDED] .close() method on PowerSyncDatabaseProtocol to close a database connection.

  • [FIXED] Updated the powersync-kotlin dependency to version 1.0.0-BETA29, which fixes these issues:

    • Fixed a potential race condition between jobs in connect() and disconnect().

    • Fixed a race condition causing data received during uploads not to be applied.

    • Fixed an issue where automatic driver migrations would fail with the error: Sqlite operation failure database is locked attempted to run migration and failed. closing connection

1.0.0-Beta.9

  • [ADDED] Enabled Full Text Search on iOS platforms. An example implementation is not yet available, however our JavaScript implementations can be used as a guide in the mean time, or reach out to us on Discord. (PR #145)

  • [ADDED] For advanced use cases: The ability to update the schema for existing PowerSync clients using updateSchema(). (PR #154)

  • [IMPROVED] Unified concurrency model across platforms by introducing a pool of read connections and a single write connection, simplifying driver implementation and enabling concurrent reads. This also brings the architecture in line with other PowerSync SDKs. (PR #145)

  • [IMPROVED] Added queuing protection and warnings when connecting multiple PowerSync clients to the same database file, avoiding inconsistent state issues and improving the reliability of watched queries. (PR #146)

  • [IMPROVED] Switched to statically linking SQLite on native platforms since dynamic extension loading is disabled on Apple platforms. (PR #147)

  • [FIXED] A bug where local only, insert only and view name overrides were not applied for schema tables. (PR #154)

  • [FIXED] Updated powersync-sqlite-core to v0.3.12, which fixes powersync_last_synced_at() returning stale information. 

1.0.0-Beta.8

  • [ADDED] Support for sync bucket priorities to sync critical data first. Learn more.

  • [ADDED] The ability to throttle watched queries via the optional throttleMs parameter. This will prevent these queries from re-running within the specified duration and therefore reduce the load for frequently updating tables.

  • [IMPROVED] Internally improved the query logic for watch() queries, by optimizing table update handling, enhancing thread safety, and simplifying the implementation (see the PR).

  • [FIXED] The uploading and downloading Sync Status indicators not correctly emitting status events.

1.0.0-Beta.7

  • [FIXED] An issue where throwing exceptions in the query mapper could cause a runtime crash.

  • [IMPROVED] Internally improved type casting.

  • [IMPROVED] Internals of the watch() query.

1.0.0-Beta.6

  • [BREAKING CHANGE]: watch queries are now throwable and therefore will need to be accompanied by a try e.g.

try database.watch()
  • [BREAKING CHANGE]: transaction functions are now throwable and therefore will need to be accompanied by a try e.g.

try await database.writeTransaction { transaction in
  try transaction.execute(...)
}
  • [IMPROVED] Allow execute errors to be handled

  • [IMPROVED]userId is now set to nil by default and therefore it is no longer required to be set to nil when instantiating PowerSyncCredentials and can therefore be left out.

1.0.0-Beta.5

  • [IMPROVED] Error handling for errors originating in the Kotlin SDK.

  • [IMPROVED] __fetchCredentials to log the error but not cause an app crash on error.

1.0.0-Beta.4

  • [IMPROVED] Ability to use the column name to get the pertaining value when using the cursor instead of having to use the index number. The following functions now accept a column name parameter: getBoolean,getBooleanOptional,getString,getStringOptional, getLong,getLongOptional, getDouble,getDoubleOptional.

  • BREAKING CHANGE: This should not affect anyone, but we made KotlinPowerSyncCredentials, KotlinPowerSyncDatabase and KotlinPowerSyncBackendConnector private as these should never have been public.

1.0.0-Beta.3

  • BREAKING CHANGE: Updates the underlying powersync-kotlin package to BETA18.0 which requires transactions to become synchronous as opposed to asynchronous.

    • Previously:

      try await database.writeTransaction { transaction in
        try await transaction.execute(
          sql: "INSERT INTO users (id, name, email) VALUES (?, ?, ?)",
          parameters: ["1", "Test User", "test@example.com"]
        )
      }

      Now:

      try await database.writeTransaction { transaction in
        transaction.execute( // <- This has become synchronous
          sql: "INSERT INTO users (id, name, email) VALUES (?, ?, ?)",
          parameters: ["1", "Test User", "test@example.com"]
        )
      }

1.0.0-Beta.2

  • [FIXED] Updated powersync-sqlite-core to v0.3.8, which fixes a view migration issue (see details).

  • [IMPROVED] Increase maximum amount of columns from 63 to 1999.

1.0.0-Beta.1

Powered by LaunchNotes