Code snippets and guidelines for common scenarios in Swift
readTransaction
.
watch
to watch for changes to the dependent tables of any SQL query.
execute
to run INSERT, UPDATE or DELETE queries.
uploadData
to send local updates to your backend service.
currentStatus
and observe changes to listen for status changes to your PowerSync instance.
hasSynced
property and observe status changes to indicate to the user whether the initial sync is in progress.
waitForFirstSync
.
downloadProgress
property from the SyncStatusData
object. downloadProgress.downloadedFraction
gives you a value from 0.0 to 1.0 representing the total sync progress. This is especially useful for long-running initial syncs.
Example: