Post

Replies

Boosts

Views

Activity

OpenAPI Swift Generator
Hello, I'm using the generator to create a client from this API: https://github.com/griptape-ai/griptape-cloud-control-plane/blob/main/models/Griptape.openapi.json Everything seems fine until I go to call a method. I get an error on a DateTime format mismatch in the response. Client error - cause description: 'Unknown', underlying error: DecodingError: dataCorrupted - at : Expected date string to be ISO8601-formatted. (underlying error: <nil>), Is there a decoder option or something I can attach to the generated client code to adjust for this?
2
0
671
Jan ’24
Syncing SwiftData with server API
Hello, I have a List view that populates from a REST API (listApiKeys() calls out to server). The response is decoded and stored in a swiftdata model. It looks like this: NavigationStack(path: $path) { List { ForEach(keys) { key in NavigationLink(value: key) { Text(key.name) } } } .navigationDestination(for: GtApiKey.self) { key in EditApiKeyView(apiKey: key, navigationPath: $path) } .refreshable { try? modelContext.delete(model: GtApiKey.self) await listApiKeys() } .toolbar { Button("Create Key", systemImage: "plus", action: createKey) } } .navigationTitle("test apikeys") .task { await listApiKeys() } This all works fine and SwiftData stores everything great. If I click into a single object's edit view, everything works great as well. My question is how do I sync changes to the SwiftData entry back to the server. My edit view uses a @Bindable and any changes auto-sync to SwiftData (expected). But, I can't seem to figure out where to catch those events or prevent them before I can send the PUT call to the REST API. This seems like a pretty basic pattern. But all the docs / tutorials load data then only change locally. I couldn't find one that get in sync w/ a server side API. Thanks in advance!
0
0
579
Feb ’24