File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
PowerSyncKotlin/src/appleMain/kotlin/com/powersync Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 22
33package com.powersync
44
5+ import com.powersync.sync.ConnectionMethod
6+
57/* *
68 * Helper class designed to bridge SKIEE methods and allow them to throw
79 * `PowerSyncException`. This is necessary because these exceptions cannot
@@ -13,3 +15,15 @@ package com.powersync
1315 */
1416@Throws(PowerSyncException ::class )
1517public fun throwPowerSyncException (exception : PowerSyncException ): Unit = throw exception
18+
19+ /* *
20+ * Creates a [ConnectionMethod] from a simple boolean, because creating the actual instance with
21+ * the default constructor is not possible from Swift due to an optional argument with an internal
22+ * default value.
23+ */
24+ @OptIn(ExperimentalPowerSyncAPI ::class )
25+ public fun createConnectionMethod (webSocket : Boolean ): ConnectionMethod = if (webSocket) {
26+ ConnectionMethod .WebSocket ()
27+ } else {
28+ ConnectionMethod .Http
29+ }
You can’t perform that action at this time.
0 commit comments