From 33cd71ccb8570ee4799f6f310c7186d4e7d5c330 Mon Sep 17 00:00:00 2001 From: Simon Binder Date: Thu, 17 Jul 2025 12:25:30 +0200 Subject: [PATCH] Raw tables: Mention Swift support --- usage/use-case-examples/raw-tables.mdx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/usage/use-case-examples/raw-tables.mdx b/usage/use-case-examples/raw-tables.mdx index 8791d4be..48617a3d 100644 --- a/usage/use-case-examples/raw-tables.mdx +++ b/usage/use-case-examples/raw-tables.mdx @@ -24,6 +24,7 @@ Raw tables were introduced in the following versions of our client SDKs: - __JavaScript__ (Node: `0.8.0`, React-Native: `1.23.0`, Web: `1.24.0`) - __Dart__: Version 1.15.0 of `package:powersync`. - __Kotlin__: Version 1.3.0 +- __Swift__: Version 1.3.0 Also note that raw tables are only supported by the new [Rust-based sync client](https://releases.powersync.com/announcements/improved-sync-performance-in-our-client-sdks), which is currently opt-in. @@ -175,11 +176,29 @@ val schema = Schema(listOf( -Unfortunately, raw tables are not available in the Swift SDK yet. +To define a raw table, include it in the list of tables passed to the `Schema`: + +```Swift +let lists = RawTable( + name: "todo_lists", + put: PendingStatement( + sql: "INSERT OR REPLACE INTO todo_lists (id, created_by, title, content) VALUES (?, ?, ?, ?)", + parameters: [.id, .column("created_by"), .column("title"), .column("content")] + ), + delete: PendingStatement( + sql: "DELETE FROM todo_lists WHERE id = ?", + parameters: [.id], + ), +) + +let schema = Schema(lists) +``` Unfortunately, raw tables are not available in the .NET SDK yet. + +------