Releases: powersync-ja/powersync-swift
PowerSync 1.6.0
- Update core extension to 0.4.6 (changelog)
- Add
getCrudTransactions(), returning an async sequence of transactions. - Compatibility with Swift 6.2 and XCode 26.
- Update minimum MacOS target to v12
- Update minimum iOS target to v15
- [Attachment Helpers] Added automatic verification or records'
local_urivalues onAttachmentQueueinitialization.
initialization can be awaited withAttachmentQueue.waitForInit().AttachmentQueue.startSync()also performs this verification.
waitForInit()is only recommended ifstartSyncis not called directly after creating the queue.
PowerSync 1.5.1
- Update core extension to 0.4.5 (changelog)
- Additional Swift 6 Strict Concurrency Checking declarations added for remaining protocols in #75
- Fix issue in legacy sync client where local writes made offline could have their upload delayed until a keepalive event was received. This could also cause downloaded updates to be delayed even further until all uploads were completed in powersync-ja/powersync-kotlin#255
PowerSync 1.5.0
-
Fix null values in CRUD entries being reported as strings in #69
-
Added support for Swift 6 strict concurrency checking in #70
- Accepted query parameter types have been updated from
[Any]to[Sendable]. This should cover all supported query parameter types. - Query and lock methods' return
Resultgeneric types now should extendSendable. - Deprecated default
open class PowerSyncBackendConnector. Devs should preferably implement thePowerSyncBackendConnectorProtocol
- Accepted query parameter types have been updated from
-
Potential Breaking Change: Attachment helpers have been updated to better support Swift 6 strict concurrency checking.
Actorisolation is improved, but developers who customize or extendAttachmentQueuewill need to update their implementations. The default instantiation ofAttachmentQueueremains unchanged.
AttachmentQueueProtocolnow defines the basic requirements for an attachment queue, with most base functionality provided via an extension. Custom implementations should extendAttachmentQueueProtocol. -
Added
PowerSyncDynamicproduct to package. Importing this product should restore XCode preview functionality in #71 -
[Internal] Instantiate Kotlin Kermit logger directly in #67
-
[Internal] Improved connection context error handling in #69
PowerSync 1.4.0
Full Changelog: 1.3.1...1.4.0
PowerSync 1.3.1
- Update SQLite to 3.50.3.
- Support receiving binary sync lines over HTTP when the Rust client is enabled.
- Remove the experimental websocket transport mode.
PowerSync 1.3.0
- Use version
0.4.2of the PowerSync core extension, which improves the reliability
of the new Rust client implementation. - Add support for raw tables, which
are custom tables managed by the user instead of JSON-based views managed by the SDK. - Fix attachments never downloading again when the sandbox path of the app (e.g. on the simulator)
changes.
PowerSync 1.2.1
- Use version
0.4.1of the PowerSync core extension, which fixes an issue with the new Rust client implementation. - Fix crud uploads when web sockets are used as a connection method.
PowerSync 1.2.0
- Improved
CrudBatchandCrudTransactioncompletefunction extensions. Developers no longer need to specifynilas an argument forwriteCheckpointwhen callingCrudBatch.complete. The basecompletefunctions still accept an optionalwriteCheckpointargument if developers use custom write checkpoints.
guard let finalBatch = try await powersync.getCrudBatch(limit: 100) else {
return nil
}
- try await batch.complete(writeCheckpoint: nil)
+ try await batch.complete()- Fix reported progress around compactions / defrags on the sync service.
- Use version
0.4.0of the PowerSync core extension, which improves sync performance. - Add a new sync client implementation written in Rust instead of Kotlin. While this client is still
experimental, we intend to make it the default in the future. The main benefit of this client is
faster sync performance, but upcoming features will also require this client. We encourage
interested users to try it out by opting in to experimental APIs and passing options when
connecting:Switching between the clients can be done at any time without compatibility issues. If you run@_spi(PowerSyncExperimental) import PowerSync try await db.connect(connector: connector, options: ConnectOptions( newClientImplementation: true, ))
into issues with the new client, please reach out to us! - In addition to HTTP streams, the Swift SDK also supports fetching sync instructions from the
PowerSync service in a binary format. This requires the new sync client, and can then be enabled
on the sync options:@_spi(PowerSyncExperimental) import PowerSync try await db.connect(connector: connector, options: ConnectOptions( newClientImplementation: true, connectionMethod: .webSocket, ))
PowerSync 1.1.0
- Add sync progress information through
SyncStatusData.downloadProgress. - Add
trackPreviousValuesoption onTablewhich setsCrudEntry.previousValuesto previous values on updates. - Add
trackMetadataoption onTablewhich adds a_metadatacolumn that can be used for updates.
The configured metadata is available throughCrudEntry.metadata. - Add
ignoreEmptyUpdatesoption which skips creating CRUD entries for updates that don't change any values.
PowerSync 1.0.0
-
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.
-
Deprecated
PowerSyncCredentialsuserIdfield. This value is not used by the PowerSync service. -
Added
readLockandwriteLockAPIs. These methods allow obtaining a SQLite connection context without starting a transaction. -
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
BRAKING CHANGESsection for more details. Updated protocols include:ConnectionContext- The context provided byreadLockandwriteLockTransaction- The context provided byreadTransactionandwriteTransactionCrudBatch- Response fromgetCrudBatchCrudTransactionResponse fromgetNextCrudTransactionCrudEntry- Crud entries forCrudBatchandCrudTransactionUpdateType- Operation type forCrudEntrysSqlCursor- Cursor used to map SQLite results to typed result setsJsonParam- JSON parameters used to declare client parameters in theconnectmethodJsonValue- Individual JSON field types forJsonParam
-
Database and transaction/lock level query
executemethods now have@discardableResultannotation. -
Query methods'
parameterstyping has been updated to[Any?]from[Any]. This makes passingnilor optional values to queries easier. -
AttachmentContext,AttachmentQueue,AttachmentServiceandSyncingServiceare are now explicitly declared asopenclasses, allowing them to be subclassed outside the defining module.
BREAKING CHANGES:
- Completing CRUD transactions or CRUD batches, in the
PowerSyncBackendConnectoruploadDatahandler, now has a simpler invocation.
- _ = try await transaction.complete.invoke(p1: nil)
+ try await transaction.complete()indexbasedSqlCursorgetters now throw if the query result column value isnil. This is now consistent with the behaviour of named column getter operations. NewgetXxxxxOptional(index: index)methods are available if the query result value could benil.
let results = try transaction.getAll(
sql: "SELECT * FROM my_table",
parameters: [id]
) { cursor in
- cursor.getString(index: 0)!
+ cursor.getStringOptional(index: 0)
+ // OR
+ // try cursor.getString(index: 0) // if the value should be required
}SqlCursorgetters now directly return Swift types.getLonghas been replaced withgetInt64.
let results = try transaction.getAll(
sql: "SELECT * FROM my_table",
parameters: [id]
) { cursor in
- cursor.getBoolean(index: 0)?.boolValue,
+ cursor.getBooleanOptional(index: 0),
- cursor.getLong(index: 0)?.int64Value,
+ cursor.getInt64Optional(index: 0)
+ // OR
+ // try cursor.getInt64(index: 0) // if the value should be required
}- Client parameters now need to be specified with strictly typed
JsonValueenums.
try await database.connect(
connector: PowerSyncBackendConnector(),
params: [
- "foo": "bar"
+ "foo": .string("bar")
]
)SyncStatusvalues now use Swift primitives for status attributes.lastSyncedAtnow is ofDatetype.
- let lastTime: Date? = db.currentStatus.lastSyncedAt.map {
- Date(timeIntervalSince1970: TimeInterval($0.epochSeconds))
- }
+ let time: Date? = db.currentStatus.lastSyncedAtcrudThrottleMsandretryDelayMsin theconnectmethod have been updated tocrudThrottleandretryDelaywhich are now of typeTimeInterval. Previously the parameters were specified in milliseconds, theTimeIntervaltyping now requires values to be specified in seconds.
try await database.connect(
connector: PowerSyncBackendConnector(),
- crudThrottleMs: 1000,
- retryDelayMs: 5000,
+ crudThrottle: 1,
+ retryDelay: 5,
params: [
"foo": .string("bar"),
]
)throttleMsin the watched queryWatchOptionshas been updated tothrottlewhich is now of typeTimeInterval. Previously the parameters were specified in milliseconds, theTimeIntervaltyping now requires values to be specified in seconds.
let stream = try database.watch(
options: WatchOptions(
sql: "SELECT name FROM users ORDER BY id",
- throttleMs: 1000,
+ throttle: 1,
mapper: { cursor in
try cursor.getString(index: 0)
}
))