• Start

Languages

/

Swift

/

Methods

SDK methods

The Swift SDK for SurrealDB enables simple and advanced querying of a remote database.

The Swift SDK exposes its functionality through the SurrealHTTPClient and SurrealWebSocketClient types, which share the same API. This page lists the methods available on a connected client.

MethodDescription
client.connect()Connects the client to the underlying endpoint
client.use(namespace, database)Switch to a specific namespace and database
MethodDescription
client.signup(credentials)Signs this connection up to a specific authentication access
client.signin(credentials)Signs this connection in to a specific authentication level
client.authenticate(token)Authenticates the current connection with a JWT token
client.invalidate()Invalidates the authentication for the current connection
MethodDescription
client.select(model)Selects all records in a table, or a specific record
client.query(query)Runs a query built with the query DSL or macros
client.queryRaw(sql, bindings)Runs a raw SurrealQL query with bound parameters
client.live(query)Subscribes to changes via a live query (WebSocket only)
client.kill(liveQueryID)Kills a running live query
MethodDescription
client.create(model)Creates a record in the database
client.update(model)Updates matching records, or a specific record
client.upsert(model)Creates or updates matching records
client.delete(model)Deletes matching records, or a specific record

Was this page helpful?