Docs Client library reference Swift
v0.2.6-alpha.3Swift: Inspect
inspect() answers the same five-field snapshot KizunaSyncInspector.snapshot() reads, decoded as a plain dictionary rather than the typed KizunaSyncInspectorSnapshot. Most apps call Inspector instead; this method is the one the typed reading is built on.
Examples#
Basic#
// TodoApp/TodoListView.swift (excerpt)
import KizunaSync
let raw = try await kizunasync.inspect()
let depth = raw["depth"] as? Int ?? 0Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
(none) | — | — | This method takes no arguments. |
Returns#
[String: Any], decoded from the engine's JSON, with these keys.
| Name | Type | Required | Description |
|---|---|---|---|
queued | [[String: Any]] | — | The head of the outbox, oldest first. |
depth | Int | — | The same count Outbox depth returns. |
last_mutation_id | String? | — | The exactly-once push watermark: the mutation id of the last entry the server confirmed applied, not the last mutation queued. nil until a push lands. |
cursor | String | — | The durable pull cursor, also on Checkpoint. |
client_id | String | — | The client's current registered identity. It changes after Reset. |
Errors#
| Code | Condition |
|---|---|
ENGINE_UNAVAILABLE | The bridge answered with bytes that do not decode to a JSON object. |
ENGINE_UNAVAILABLE | The client has no engine because Initializing has not run. |
Notes#
last_mutation_id is the watermark a completed push advances, not a record of what is queued. A device with ten mutations waiting in the outbox and none pushed answers nil here even though depth reads 10. Inspector wraps this call, adds the bounded verdict ring, and answers a typed KizunaSyncInspectorSnapshot. Reach for inspect() directly only when the raw dictionary is what the call site wants.
Related reference#
Found a problem? Edit this page on GitHub