You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Gallery of example projects/demo apps built with Kotlin Multiplatform and PowerSync.
18
18
</Card>
19
19
</CardGroup>
20
20
21
+
<Note>
22
+
The PowerSync Swift SDK is currently in a beta release. It is suitable for production use at this stage given you've tested your use cases extensively. Breaking changes are unlikely to occur.
23
+
</Note>
24
+
21
25
### SDK Features
22
26
23
27
* Provides real-time streaming of database changes.
Gallery of example projects/demo apps built with PowerSync and Swift.
15
+
</Card>
16
+
</CardGroup>
17
+
6
18
<Note>
7
-
The PowerSync Swift SDK is currently in an alpha release. It is not suitable for production use at this stage unless you've tested your use cases extensively. Breaking changes are still likely to occur.
19
+
The PowerSync Swift SDK is currently in a beta release. It is suitable for production use at this stage given you've tested your use cases extensively. Breaking changes are unlikely to occur.
8
20
</Note>
9
21
10
22
## Kotlin Multiplatform -> Native Swift SDK
11
23
12
-
This SDK is an extension of the [Kotlin Multiplatform SDK](https://github.com/powersync-ja/powersync-kotlin), and utilizes the API tool [SKIE](https://skie.touchlab.co/) to generate and publish a [PowerSync SDK](https://github.com/powersync-ja/powersync-kotlin/tree/main/PowerSync) that can be used in a standalone Swift app. Further details about this configuration can be found in our blog [here](https://www.powersync.com/blog/using-kotlin-multiplatform-with-kmmbridge-and-skie-to-publish-a-native-swift-sdk).
13
-
14
-
For the beta, we are moving away from this Kotlin-based architecture towards more Swift-native APIs. For the stable release, will are planning a fully native Swift SDK.
24
+
The PowerSync Swift SDK currently makes use of the [PowerSync Kotlin Multiplatform SDK](https://github.com/powersync-ja/powersync-kotlin) with the API tool [SKIE](https://skie.touchlab.co/) and KMMBridge under the hood to help generate and publish a Swift package. We will move to an entirely Swift native SDK in v1 and do not expect there to be any breaking changes.
15
25
16
26
<Tip>
17
27
**Demo App**
18
28
19
-
We recommend the [Supabase Todo List Demo](https://github.com/powersync-ja/powersync-kotlin-swift-demo) app as a starting point for using the Swift SDK. See the README for details to run it.
29
+
We recommend the [Supabase Todo List Demo](https://github.com/powersync-ja/powersync-swift/tree/main/Demo) app as a starting point for using the Swift SDK. See the README for details to run it.
1. Follow [this](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app#Add-a-package-dependency) guide to add a package to your project.
74
-
2.When searching for the package use [https://github.com/powersync-ja/powersync-kotlin.git](https://github.com/powersync-ja/powersync-kotlin.git) as the URL and include the exact version `1.0.0-BETA5.0` as shown below:
78
+
2. When searching for the package use [https://github.com/powersync-ja/powersync-swift.git](https://github.com/powersync-ja/powersync-swift.git) as the URL and include the exact version e.g. `1.0.0-Beta.x` as shown below:
75
79
76
80
<Frame>
77
-
78
-
<imgsrc="/images/swift.avif"></img>
81
+
<imgsrc="/images/Swift-Xcode.png"></img>
79
82
</Frame>
80
83
81
-
3. Do the same for `power-sqlite-core-swift` using [https://github.com/powersync-ja/powersync-sqlite-core-swift.git](https://github.com/powersync-ja/powersync-kotlin.git) and choose a range between `0.3.1` and `0.4.0` as shown below:
82
-
<Frame>
83
-
<imgsrc="/images/image (1).png"></img>
84
-
</Frame>
84
+
### Migrating from the Alpha to the Beta SDK
85
85
86
-
<Note>
87
-
Use the exact version for `powersync-kotlin` as we are actively making changes to the Swift SDK which could result in breaking changes. The version history can be found [here](https://central.sonatype.com/artifact/com.powersync/core/versions).
88
-
</Note>
86
+
The beta version of this SDK introduces a Swift-native wrapper around the package generated from the Kotlin Multiplatform SDK, bringing a more Swift-native interface for developers. This results in several API updates from the more Kotlin-based alpha version. The main changes are:
87
+
* The `PowerSyncDatabase` no longer needs a driver argument and it must be removed.
88
+
* The interface for `PowerSyncDatabase` now uses `PowerSyncDatabaseProtocol` which may require some changes to databases uses.
89
+
* If you were using `__uploadData` and `__fetchCredentials` in your `PowerSyncBackendConnector` you must remove the `__` and update the methods to `uploadData` and `fetchCredentials`.
90
+
*`@MainThread` usage is no longer required and should be removed.
91
+
* Implementing `SuspendTaskWrapper` for database transactions is no longer required and should be removed.
92
+
93
+
See the [Todo List Demo app](https://github.com/powersync-ja/powersync-swift/tree/main/Demo) as a reference.
// implement fetchCredentials to obtain the necessary credentials to connect to your backend
211
-
// See an example implementation in https://github.com/powersync-ja/powersync-kotlin-swift-demo/blob/main/PowerSyncExample/PowerSync/SupabaseConnector.swift
204
+
// See an example implementation in https://github.com/powersync-ja/powersync-swift/blob/main/Demo/PowerSyncExample/PowerSync/SupabaseConnector.swift
212
205
213
206
return {
214
207
endpoint: '[Your PowerSync instance URL or self-hosted endpoint]',
@@ -218,7 +211,7 @@ class MyConnector: PowerSyncBackendConnector {
218
211
}
219
212
}
220
213
221
-
overridefuncuploadData(database: any PowerSyncDatabase) asyncthrows {
// Implement uploadData to send local changes to your backend service
223
216
// You can omit this method if you only want to sync data from the server to the client
224
217
// See an example implementation under Usage Examples (sub-page)
@@ -228,10 +221,6 @@ class MyConnector: PowerSyncBackendConnector {
228
221
229
222
```
230
223
231
-
<Info>
232
-
If you are using **Supabase**, you can use [SupabaseConnector.swift](https://github.com/powersync-ja/powersync-kotlin-swift-demo/blob/main/PowerSyncExample/PowerSync/SupabaseConnector.swift) as a starting point.
233
-
</Info>
234
-
235
224
## Using PowerSync: CRUD functions
236
225
237
226
Once the PowerSync instance is configured you can start using the SQLite DB functions.
Copy file name to clipboardExpand all lines: installation/client-side-setup.mdx
+11-29Lines changed: 11 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ The next step after configuring your database and connecting it to your PowerSyn
18
18
19
19
2. Write mutations to your backend
20
20
21
-
PowerSync currently supports apps built in [Flutter](/client-sdk-references/flutter), [React Native & Expo](/client-sdk-references/react-native-and-expo), [JavaScript Web](/client-sdk-references/javascript-web), [Kotlin Multiplatform](/client-sdk-references/kotlin-multiplatform) (beta), and [Swift](/client-sdk-references/swift) (alpha).
21
+
PowerSync currently supports apps built in [Flutter](/client-sdk-references/flutter), [React Native & Expo](/client-sdk-references/react-native-and-expo), [JavaScript Web](/client-sdk-references/javascript-web), [Kotlin Multiplatform](/client-sdk-references/kotlin-multiplatform) (beta), and [Swift](/client-sdk-references/swift) (beta).
22
22
23
23
Please see the steps based on your app framework:
24
24
@@ -175,11 +175,8 @@ Please see the steps based on your app framework:
@@ -188,12 +185,8 @@ Please see the steps based on your app framework:
188
185
dependencies: [
189
186
.product(
190
187
name: "PowerSync",
191
-
package: "powersync-kotlin"
192
-
),
193
-
.product(
194
-
name: "PowerSyncSqliteCore",
195
-
package: "powersync-sqlite-core-swift"
196
-
),
188
+
package: "powersync-swift"
189
+
)
197
190
]
198
191
)
199
192
]
@@ -203,26 +196,15 @@ Please see the steps based on your app framework:
203
196
2. Using Xcode:
204
197
205
198
1. Follow [this](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app#Add-a-package-dependency) guide to add a package to your project.
199
+
2. When searching for the package use [https://github.com/powersync-ja/powersync-swift.git](https://github.com/powersync-ja/powersync-swift.git) as the URL and include the exact version e.g. `1.0.0-Beta.x` as shown below:
206
200
207
-
2. When searching for the package use [https://github.com/powersync-ja/powersync-kotlin.git](https://github.com/powersync-ja/powersync-kotlin.git) as the URL and include the exact version `1.0.0-BETA5.0` as shown below:
208
-
209
-
<Frame>
210
-
<imgsrc="/images/swift.avif" />
211
-
</Frame>
212
-
213
-
3. Do the same for `power-sqlite-core-swift` using [https://github.com/powersync-ja/powersync-sqlite-core-swift.git](https://github.com/powersync-ja/powersync-kotlin.git) and choose a range between `0.3.1` and `0.4.0` as shown below:
214
-
215
-
<Frame>
216
-
<imgsrc="/images/image (1).png" />
217
-
</Frame>
218
-
219
-
<Note>
220
-
Use the exact version for `powersync-kotlin` as we are actively making changes to the Swift SDK which could result in breaking changes. The version history can be found [here](https://central.sonatype.com/artifact/com.powersync/core/versions).
221
-
</Note>
201
+
<Frame>
202
+
<imgsrc="/images/Swift-Xcode.png"></img>
203
+
</Frame>
222
204
223
205
See the full SDK reference for further details and getting started instructions:
0 commit comments