Skip to content

Releases: get-convex/convex-swift

Convex for Swift 0.7.0

04 Dec 03:30

Choose a tag to compare

This is a minor feature release.

It includes a new API to observe the state of the underlying WebSocket connection to the Convex backend.

Here's a small example showing how to use watchWebSocketState() - it changes the color of an icon from blue to red depending on whether the WebSocket is connected or connecting. The Convex client will always try and connect the WebSocket so it will always be in one of those two states.

import SwiftUI
import ConvexMobile
internal import Combine

let convex = ConvexClient(deploymentUrl: "$URL")

struct ContentView: View {
  @State private var isConnected: Bool = false
  
  var body: some View {
    VStack {
      Image(systemName: "globe")
        .imageScale(.large)
        .foregroundStyle(isConnected ? (Color.blue) : Color.red)
    }
    .task {
      for await value: WebSocketState in convex.watchWebSocketState().values {
        switch value {
	        case .connected:
	          isConnected = true
	        case .connecting:
	          isConnected = false
        }
      }
    }
    .padding()
  }
}

Convex for Swift 0.6.1

20 Nov 04:13

Choose a tag to compare

This is a bug fix release.

Includes a dependency on an updated version of convex-rs with a fix for a deadlock.

get-convex/convex-rs@8d500d0

Prior to this version, applications receiving rapid query updates while sending outgoing requests could experience the ConvexClient becoming unresponsive.

Convex for Swift 0.6.0

31 Oct 01:42

Choose a tag to compare

This is a minor feature addition release.

There's a new initConvexLogging method which will surface Convex client logs in OSLog. This should give developers greater visibility into the state of the Convex client throughout the lifecycle of their applications. Example usage:

import SwiftUI
import ConvexMobile

@main
struct SampleApp: App {
  init() {
    // After this call, use of ConvexClient elsewhere in the app will generate logs.
    initConvexLogging()
  }
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}