Conflict handling, errors, testing, concurrency model
Conflict handling
See Errors — version_conflict for the enriched 409 payload and Conflicts for the resolution model. The Swift SDK exposes the three modes as ClientConfiguration.conflictStrategy and UpdateOptions.conflict.
.auto (default), .manual (throws ConflictError with current, ancestor, conflictingFields, clientPatch, mergePolicy), and .callback are the three modes..auto is policy-aware. The SDK reads the type’s merge_policy directly from the 409 response and resolves each conflicting field per its strategy. last_writer_wins fields take the server’s value; keep_both_copies fields spawn a sibling item of the same type, tagged conflicted-copy, populated from the client’s in-flight values for the keep-both fields and the server’s current values for the rest. The original item retains the server’s winning state for the conflicted keep-both fields; non-keep-both client changes apply normally.The SyncEngine.events stream emits .conflictAutoMerged(payload:) whenever a replay auto-merge fires:
public struct ConflictAutoMergedPayload: Sendable { public let itemId: String // the original item public let mergedItemId: String // the original item id (post-retry) public let conflictedCopyId: String? // the new sibling, when keep-both spawned one public let fields: [String] // the conflicting fields public let strategy: ConflictResolutionOutcome // .lastWriterWins, .keepBothCopies, .mixed}
Apps typically toast when conflictedCopyId != nil — the user’s in-flight edit was preserved as a sibling rather than discarded.In synced mode the chosen conflict strategy is captured with the queued mutation so it applies on replay against any 409 the server returns. The .callback resolver closure can’t be queued (closures aren’t Codable); on replay, .callback degrades to .auto.
Errors
Errors are subclasses of a base MarfaError. Pattern-match on the subclass:
do { _ = try await client.items.get(id: "bogus")} catch let error as NotFoundError { // missing item} catch let error as ConflictError { // error.current, error.ancestor, error.conflictingFields} catch let error as LocalModeUnsupportedError { // remote-only call (blobs, types, keys, webhooks) on a pure-local client} catch let error as MarfaError { // everything else — error.code (String), error.message, error.status, error.details}
MarfaError.code is a String, not an enum. Branch on the subclass where one exists; fall through to MarfaError and inspect code for anything else. Error codes are stable strings ("version_conflict", "rate_limited") — branch on them, not on the message.
MarfaSDKTestSupport ships as a separate product alongside MarfaSDK and provides scaffolding for unit tests:
MockTransport — stub for the Transport protocol. Queue responses, assert on captured requests.
InMemoryKeychain — in-memory SecureStorage substitute. SPM test binaries run unsigned and can’t reach the real Keychain.
MarfaSDKTest.makeInMemoryClient() — pure-local MarfaClient backed by an in-memory ModelContainer. Drop-in replacement for MarfaClient.local(path:) in test setups; sidesteps the cross-test container issues that show up when sharing a file-backed store across cases in the same process.
Add MarfaSDKTestSupport as a dependency on your test target only. The product is non-semver-stable across SDK minor versions and is not intended for production code.The Transport protocol is public. MockTransport exists primarily for mocking the network in unit tests; the production MarfaClient init always instantiates URLSessionTransport. The protocol includes rawUpload(method:path:body:contentType:query:onBytesSent:) — the progress-aware upload hook that forwards URLSessionTaskDelegate.didSendBodyData — so stubs exercising byte-progress code paths (e.g. against BlobUploadProgressQuery) can drive those callbacks deterministically from a mock.
Concurrency model
MarfaClient is Sendable — safe to pass across actors.
Namespace methods are async throws and don’t require caller isolation.
LocalStore, MutationQueue, SyncEngine, ConnectionStateManager are Swift actors. Shared state is actor-isolated; callers never synchronise manually.
MarfaStore and query classes are @MainActor @Observable — observe them directly from SwiftUI views.
The whole package builds under Swift 6 strict concurrency with zero @unchecked Sendable leaks in the public surface.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Marfa","colors":{"primary":"#16A34A","light":"#07C983","dark":"#15803D"},"favicon":"https://mintcdn.com/myme-7664a40d/8jfUmaBZ6aOKERIm/favicon.svg?fit=max\u0026auto=format\u0026n=8jfUmaBZ6aOKERIm\u0026q=85\u0026s=8042d478021aa097ede99200e8786442","footer":{},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"myme-7664a40d","hasAudioNarration":false,"actualSubdomain":"myme-7664a40d","customDomains":["docs.myme.so"],"gitSource":{"type":"github","owner":"withmarfa","repo":"docs-mintlify","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":"","_id":"6b10de689ffae5051c41054c"},"entitlements":{},"buildId":"6ae94b513321ce4af67fd60f:success","clientVersion":"0.0.4448","searchFilterCounts":[{"language":"default","tag":"API reference","count":96},{"language":"default","tag":"Documentation","count":41},{"language":"default","tag":"Concepts","count":25},{"language":"default","tag":"Items","count":19},{"language":"default","tag":"Self-hosting","count":14},{"language":"default","tag":"API","count":10},{"language":"default","tag":"Admin","count":10},{"language":"default","tag":"SDKs","count":8},{"language":"default","tag":"Edges","count":7},{"language":"default","tag":"Swift","count":6}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"auth-vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"sdks/swift/errors-and-testing","slug":"/sdks/swift/errors-and-testing","pageMetadata":{"title":"Errors and testing","description":"Conflict handling, errors, testing, concurrency model","href":"/sdks/swift/errors-and-testing"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Conflict handling, errors, testing, concurrency model\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Info}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`conflict-handling`,children:`Conflict handling`}),`\n`,_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/api/errors#version-conflict`,children:`Errors — version_conflict`}),` for the enriched 409 payload and `,_jsx(_components.a,{href:`/concepts/conflicts`,children:`Conflicts`}),` for the resolution model. The Swift SDK exposes the three modes as `,_jsx(_components.code,{children:`ClientConfiguration.conflictStrategy`}),` and `,_jsx(_components.code,{children:`UpdateOptions.conflict`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`swift`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`swift`,children:_jsxs(_components.code,{language:`swift`,numberOfLines:`11`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`try`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`items`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`update`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: note.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` properties`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"body\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"...\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` options`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`UpdateOptions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` version`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: note.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`version`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` conflict`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: .`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`callback`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` resolve`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { conflict `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` mergeManually`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(conflict)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`.auto`}),` (default), `,_jsx(_components.code,{children:`.manual`}),` (throws `,_jsx(_components.code,{children:`ConflictError`}),` with `,_jsx(_components.code,{children:`current`}),`, `,_jsx(_components.code,{children:`ancestor`}),`, `,_jsx(_components.code,{children:`conflictingFields`}),`, `,_jsx(_components.code,{children:`clientPatch`}),`, `,_jsx(_components.code,{children:`mergePolicy`}),`), and `,_jsx(_components.code,{children:`.callback`}),` are the three modes.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`.auto`}),` is policy-aware. The SDK reads the type’s `,_jsx(_components.code,{children:`merge_policy`}),` directly from the 409 response and resolves each conflicting field per its strategy. `,_jsx(_components.code,{children:`last_writer_wins`}),` fields take the server’s value; `,_jsx(_components.code,{children:`keep_both_copies`}),` fields spawn a sibling item of the same type, tagged `,_jsx(_components.code,{children:`conflicted-copy`}),`, populated from the client’s in-flight values for the keep-both fields and the server’s `,_jsx(_components.code,{children:`current`}),` values for the rest. The original item retains the server’s winning state for the conflicted keep-both fields; non-keep-both client changes apply normally.`]}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`SyncEngine.events`}),` stream emits `,_jsx(_components.code,{children:`.conflictAutoMerged(payload:)`}),` whenever a replay auto-merge fires:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`swift`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`swift`,children:_jsxs(_components.code,{language:`swift`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`public`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` struct`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` ConflictAutoMergedPayload`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`Sendable `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` public`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` itemId: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`String`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // the original item`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` public`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` mergedItemId: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`String`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // the original item id (post-retry)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` public`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` conflictedCopyId: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`String`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // the new sibling, when keep-both spawned one`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` public`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` fields: [`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`String`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// the conflicting fields`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` public`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` strategy: ConflictResolutionOutcome `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// .lastWriterWins, .keepBothCopies, .mixed`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Apps typically toast when `,_jsx(_components.code,{children:`conflictedCopyId != nil`}),` — the user’s in-flight edit was preserved as a sibling rather than discarded.`]}),`\n`,_jsxs(_components.p,{children:[`In synced mode the chosen `,_jsx(_components.code,{children:`conflict`}),` strategy is captured with the queued mutation so it applies on replay against any 409 the server returns. The `,_jsx(_components.code,{children:`.callback`}),` resolver closure can’t be queued (closures aren’t `,_jsx(_components.code,{children:`Codable`}),`); on replay, `,_jsx(_components.code,{children:`.callback`}),` degrades to `,_jsx(_components.code,{children:`.auto`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`errors`,children:`Errors`}),`\n`,_jsxs(_components.p,{children:[`Errors are subclasses of a base `,_jsx(_components.code,{children:`MarfaError`}),`. Pattern-match on the subclass:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`swift`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`swift`,children:_jsxs(_components.code,{language:`swift`,numberOfLines:`11`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`do`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` _`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` try`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`items`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"bogus\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` error `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`as`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` NotFoundError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // missing item`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` error `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`as`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` ConflictError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // error.current, error.ancestor, error.conflictingFields`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` error `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`as`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` LocalModeUnsupportedError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // remote-only call (blobs, types, keys, webhooks) on a pure-local client`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` error `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`as`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` MarfaError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // everything else — error.code (String), error.message, error.status, error.details`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`MarfaError.code`}),` is a `,_jsx(_components.code,{children:`String`}),`, not an enum. Branch on the subclass where one exists; fall through to `,_jsx(_components.code,{children:`MarfaError`}),` and inspect `,_jsx(_components.code,{children:`code`}),` for anything else. Error codes are stable strings (`,_jsx(_components.code,{children:`\"version_conflict\"`}),`, `,_jsx(_components.code,{children:`\"rate_limited\"`}),`) — branch on them, not on the message.`]})}),`\n`,_jsxs(_components.p,{children:[`Subclasses: `,_jsx(_components.code,{children:`NotFoundError`}),`, `,_jsx(_components.code,{children:`ValidationError`}),`, `,_jsx(_components.code,{children:`UnauthorizedError`}),`, `,_jsx(_components.code,{children:`ForbiddenError`}),`, `,_jsx(_components.code,{children:`ConflictError`}),`, `,_jsx(_components.code,{children:`NetworkError`}),`, `,_jsx(_components.code,{children:`ResponseDecodingError`}),`, `,_jsx(_components.code,{children:`LocalModeUnsupportedError`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`testing`,children:`Testing`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`MarfaSDKTestSupport`}),` ships as a separate product alongside `,_jsx(_components.code,{children:`MarfaSDK`}),` and provides scaffolding for unit tests:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`MockTransport`}),` — stub for the `,_jsx(_components.code,{children:`Transport`}),` protocol. Queue responses, assert on captured requests.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`InMemoryKeychain`}),` — in-memory `,_jsx(_components.code,{children:`SecureStorage`}),` substitute. SPM test binaries run unsigned and can’t reach the real Keychain.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`MarfaSDKTest.makeInMemoryClient()`}),` — pure-local `,_jsx(_components.code,{children:`MarfaClient`}),` backed by an in-memory `,_jsx(_components.code,{children:`ModelContainer`}),`. Drop-in replacement for `,_jsx(_components.code,{children:`MarfaClient.local(path:)`}),` in test setups; sidesteps the cross-test container issues that show up when sharing a file-backed store across cases in the same process.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Add `,_jsx(_components.code,{children:`MarfaSDKTestSupport`}),` as a dependency on your test target only. The product is non-semver-stable across SDK minor versions and is not intended for production code.`]}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`Transport`}),` protocol is public. `,_jsx(_components.code,{children:`MockTransport`}),` exists primarily for mocking the network in unit tests; the production `,_jsx(_components.code,{children:`MarfaClient`}),` init always instantiates `,_jsx(_components.code,{children:`URLSessionTransport`}),`. The protocol includes `,_jsx(_components.code,{children:`rawUpload(method:path:body:contentType:query:onBytesSent:)`}),` — the progress-aware upload hook that forwards `,_jsx(_components.code,{children:`URLSessionTaskDelegate.didSendBodyData`}),` — so stubs exercising byte-progress code paths (e.g. against `,_jsx(_components.code,{children:`BlobUploadProgressQuery`}),`) can drive those callbacks deterministically from a mock.`]}),`\n`,_jsx(Heading,{level:`2`,id:`concurrency-model`,children:`Concurrency model`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`MarfaClient`}),` is `,_jsx(_components.code,{children:`Sendable`}),` — safe to pass across actors.`]}),`\n`,_jsxs(_components.li,{children:[`Namespace methods are `,_jsx(_components.code,{children:`async throws`}),` and don’t require caller isolation.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`LocalStore`}),`, `,_jsx(_components.code,{children:`MutationQueue`}),`, `,_jsx(_components.code,{children:`SyncEngine`}),`, `,_jsx(_components.code,{children:`ConnectionStateManager`}),` are Swift actors. Shared state is actor-isolated; callers never synchronise manually.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`MarfaStore`}),` and query classes are `,_jsx(_components.code,{children:`@MainActor @Observable`}),` — observe them directly from SwiftUI views.`]}),`\n`,_jsxs(_components.li,{children:[`The whole package builds under Swift 6 strict concurrency with zero `,_jsx(_components.code,{children:`@unchecked Sendable`}),` leaks in the public surface.`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Errors and testing","description":"Conflict handling, errors, testing, concurrency model","href":"/sdks/swift/errors-and-testing"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Conflict handling","slug":"conflict-handling","depth":2,"children":[]},{"title":"Errors","slug":"errors","depth":2,"children":[]},{"title":"Testing","slug":"testing","depth":2,"children":[]},{"title":"Concurrency model","slug":"concurrency-model","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"myme-7664a40d","siteName":"Marfa","title":"Errors and testing - Marfa","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-05-26T08:48:19.695Z","originalFileLocation":"sdks/swift/errors-and-testing.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Conflict handling, errors, testing, concurrency model\">\u003cmeta data-mint-head name=\"application-name\" content=\"Marfa\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/myme-7664a40d/Exj-mEeFMn7gATMX/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/myme-7664a40d/Exj-mEeFMn7gATMX/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/myme-7664a40d/Exj-mEeFMn7gATMX/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/myme-7664a40d/Exj-mEeFMn7gATMX/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/myme-7664a40d/Exj-mEeFMn7gATMX/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/myme-7664a40d/Exj-mEeFMn7gATMX/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/myme-7664a40d/Exj-mEeFMn7gATMX/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/myme-7664a40d/Exj-mEeFMn7gATMX/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/myme-7664a40d/Exj-mEeFMn7gATMX/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Errors and testing - Marfa\">\u003cmeta data-mint-head property=\"og:description\" content=\"Conflict handling, errors, testing, concurrency model\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Marfa\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.myme.so/sdks/swift/errors-and-testing\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://myme-7664a40d.mintlify.site/_mintlify/api/og/v2?division=Swift\u0026amp;title=Errors+and+testing\u0026amp;description=Conflict+handling%2C+errors%2C+testing%2C+concurrency+model\u0026amp;theme=be394bdd824f66fd2549706a\u0026amp;signature=5d93019453b17b76544fb9949114520241310b75567bc0a9d55c1dd17f9efc13\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Errors and testing - Marfa\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Conflict handling, errors, testing, concurrency model\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://myme-7664a40d.mintlify.site/_mintlify/api/og/v2?division=Swift\u0026amp;title=Errors+and+testing\u0026amp;description=Conflict+handling%2C+errors%2C+testing%2C+concurrency+model\u0026amp;theme=be394bdd824f66fd2549706a\u0026amp;signature=5d93019453b17b76544fb9949114520241310b75567bc0a9d55c1dd17f9efc13\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/myme-7664a40d/Exj-mEeFMn7gATMX/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Marfa\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#16A34A\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.myme.so/sdks/swift/errors-and-testing\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/sdks/swift/errors-and-testing.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.myme.so/#organization\",\"name\":\"Marfa\",\"url\":\"https://docs.myme.so\"},{\"@type\":\"WebSite\",\"@id\":\"https://docs.myme.so#website\",\"name\":\"Marfa\",\"url\":\"https://docs.myme.so\",\"publisher\":{\"@id\":\"https://docs.myme.so/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.myme.so/sdks/swift/errors-and-testing#webpage\",\"url\":\"https://docs.myme.so/sdks/swift/errors-and-testing\",\"name\":\"Errors and testing\",\"description\":\"Conflict handling, errors, testing, concurrency model\",\"dateModified\":\"2026-05-26T08:48:19.695Z\",\"isPartOf\":{\"@id\":\"https://docs.myme.so#website\"},\"breadcrumb\":{\"@id\":\"https://docs.myme.so/sdks/swift/errors-and-testing#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.myme.so/sdks/swift/errors-and-testing#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Swift\",\"item\":\"https://docs.myme.so/sdks/swift/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Errors and testing\",\"item\":\"https://docs.myme.so/sdks/swift/errors-and-testing\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.myme.so/sdks/swift/errors-and-testing#article\",\"headline\":\"Errors and testing\",\"name\":\"Errors and testing\",\"description\":\"Conflict handling, errors, testing, concurrency model\",\"url\":\"https://docs.myme.so/sdks/swift/errors-and-testing\",\"mainEntityOfPage\":{\"@id\":\"https://docs.myme.so/sdks/swift/errors-and-testing#webpage\"},\"dateModified\":\"2026-05-26T08:48:19.695Z\",\"publisher\":{\"@id\":\"https://docs.myme.so/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.myme.so#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Marfa\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Marfa\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/sdks/swift/errors-and-testing.md","siteName":"Marfa","nav":{"global":null,"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":"/introduction"}]},{"tab":"SDKs","pages":[{"title":"TypeScript","href":"/sdks/typescript"},{"title":"Using the SDK in Electron","href":"/sdks/typescript-electron"},{"group":"Swift","pages":[{"title":"Overview","href":"/sdks/swift/overview"},{"title":"Authentication","href":"/sdks/swift/authentication"},{"title":"Data access","href":"/sdks/swift/data-access"},{"title":"Typed models","href":"/sdks/swift/typed-models"},{"title":"Sync engine","description":"SwiftUI reactive queries, sync engine, sync events, end-to-end subscription, local IDs","href":"/sdks/swift/sync-engine"},{"title":"Errors and testing","href":"/sdks/swift/errors-and-testing"}]}]},{"tab":"API reference","pages":[{"title":"API reference","href":"/api-reference/items/list-items"}]},{"tab":"Self-hosting","pages":[{"title":"Self-hosting","href":"/self-hosting/configuration"}]}]},"basePath":"","title":"Errors and testing - Marfa","deploymentId":"dpl_XLevHnGPjzxq9mbREha5Faad63Sp","buildId":"dpl_XLevHnGPjzxq9mbREha5Faad63Sp","dynamics":[],"chunks":[]}