Skip to content

Commit 1c1f2bb

Browse files
Register extension on WatchOS
1 parent a81986e commit 1c1f2bb

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Sources/PowerSyncGRDB/Config/Configuration+PowerSync.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public extension Configuration {
2727
prepareDatabase { database in
2828
#if os(watchOS)
2929
// Use static initialization on watchOS
30-
let initResult = sqlite3_powersync_init_static(database.sqliteConnection, nil)
30+
let initResult = sqlite3_powersync_init(database.sqliteConnection, nil, nil)
3131
if initResult != SQLITE_OK {
3232
throw PowerSyncGRDBError.extensionLoadFailed("Could not initialize PowerSync statically")
3333
}

Sources/PowerSyncGRDB/SQLite/SQLite+Utils.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ func sqlite3_enable_load_extension(
77
_ onoff: Int32
88
) -> Int32
99

10+
@_silgen_name("sqlite3_powersync_init")
11+
func sqlite3_powersync_init(
12+
_ db: OpaquePointer?,
13+
_: OpaquePointer?,
14+
_: OpaquePointer?
15+
) -> Int32
16+
1017
// Similarly for sqlite3_load_extension if needed:
1118
@_silgen_name("sqlite3_load_extension")
1219
func sqlite3_load_extension(

0 commit comments

Comments
 (0)