Realtime Database · Swift Compatibility
This page tracks an integration contract: unchanged Firebase code run through a Pyric runtime seam, so there is no separate Firebase public API to measure. The rows below are its signed behavior inventory.
Integration compatibility ledger for the Pure-Swift Realtime Database client (packages/swift-client), conforming to FirebaseDatabase via Pyric WebSocket bridge transport.
Database Instance & Connection
Database.database()Returns the default Database instance bound to the active bridge connection.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#instance-default.Database.database(url:)Returns a distinct Database handle for each database URL; production isolates the data and rules of each URL's database.
FirebaseDatabase Swift specification. The test asserts the handle carries its URL; bridge operations carry no instance field. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#instance-url.each URL yields a distinct handle, but data and rules are not isolated: the bridge does not carry the instance, so every handle reaches the default database
Database.reference()Returns a DatabaseReference pointing to the root of the Realtime Database.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#ref-root.Database.reference(withPath:)Returns a DatabaseReference pointing to the specified slash-delimited path.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#ref-path.Database.goOffline() / goOnline()Suspends and resumes the Realtime Database connection to the Pyric worker. goOffline() also turns .info/connected false for that database until goOnline().
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#connection-toggle.reference(withPath: ".info/connected").observe(.value)Served by the client from its bridge connection. It reports false until the client attaches and false whenever the connection is interrupted, closed or taken offline with goOffline(), and true once the client re-attaches. An onDisconnect registered when it turns true reaches the host on the new connection, after the restore.
FirebaseDatabase Swift specification and ADR-0019 (amendment of 2026-10-16). The conformance test asserts the values across attach, goOffline() and goOnline(), and that no
.info listen or read reaches the worker. Reconnect tests: RtdbInfoConnectedTests.swift asserts false, true, false, true across a drop with no repeated value, a presence re-arm sent on the new socket after the replayed listener and the held operation, and after the Auth restore on a replaced host. Swift test: packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#info-connected.reference(withPath: ".info") / reference(withPath: ".info/serverTimeOffset")Served by the client: .info is { connected, serverTimeOffset }, and serverTimeOffset is 0.
FirebaseDatabase Swift specification and ADR-0019 (amendment of 2026-10-16). The test asserts both values, null for another
.info key, and that none reaches the worker. Swift test: packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#info-root-offset.the offset is always 0: the bridge handshake carries no server timestamp, and production delivers no offset until its first handshake
DatabaseReference Navigation & Properties
DatabaseReference.child(_:)Returns a child DatabaseReference relative to the current path.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#ref-child.DatabaseReference.parentReturns the parent DatabaseReference, or nil when called on the root reference.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#ref-parent.DatabaseReference.rootReturns the root DatabaseReference from any descendant reference.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#ref-root-prop.DatabaseReference.keyReturns the last path segment token of the reference, or nil for the root reference.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#ref-key.DatabaseReference.url / pathReturns the normalized slash-delimited full path of the reference.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#ref-path-prop.DatabaseReference.childByAutoId()Generates a new child DatabaseReference with a chronologically ordered unique push ID.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#ref-push.DatabaseReference.childByAutoId().keyMonotonically orders generated push keys lexicographically by creation timestamp.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#ref-push-key-ordering.Write Operations
DatabaseReference.setValue(_:)Overwrites data at the reference path with the provided JSON-serializable value.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#write-set.DatabaseReference.setValue(nil)Deletes data at the reference path when setValue is called with nil.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#write-set-null.DatabaseReference.setPriority(_:)Updates the ordering priority metadata of the node without altering its value.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#write-set-priority.DatabaseReference.setValue(_:andPriority:)Atomically writes the node value alongside its ordering priority metadata.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#write-set-with-priority.DatabaseReference.updateChildValues(_:)Performs a multi-path atomic update of specified child keys without overwriting omitted siblings.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#write-update.DatabaseReference.removeValue()Removes the node and all descendant data at the reference path.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#write-remove.ServerValue Sentinels
ServerValue.timestamp()Resolves server-side timestamp sentinel into current epoch milliseconds upon write.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#sentinel-timestamp.ServerValue.increment(_:)Atomically increments the numeric value at the target path by delta on the server.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#sentinel-increment.One-Shot Reads & DataSnapshot Inspection
DatabaseReference.getData()Fetches a one-shot DataSnapshot of the current data at the reference path.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#read-get.DataSnapshot.exists()Returns true if the DataSnapshot contains non-null data.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#snap-exists.DataSnapshot.keyReturns the key name of the location that generated the DataSnapshot.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#snap-key.DataSnapshot.valueReturns the deserialized Swift value (Dictionary, Array, String, NSNumber, or nil) of the snapshot.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#snap-value.DataSnapshot.childrenReturns an iterator of child DataSnapshots ordered according to the active query.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#snap-children.DataSnapshot.childSnapshot(forPath:)Returns a DataSnapshot for the relative descendant path within the snapshot.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#snap-child-path.DataSnapshot.priorityReturns the priority value (String, NSNumber, or nil) associated with the snapshot node.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#snap-priority.Realtime Listeners & Streams
DatabaseQuery.observe(.value) / valueStreamEmits DataSnapshot initially and upon any data change at the path via AsyncStream or observer.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#listen-value.DatabaseQuery.observe(.childAdded) / childEventsEmits childAdded event for each existing child and whenever a new child is added.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#listen-child-added.DatabaseQuery.observe(.childChanged) / childEventsEmits childChanged event whenever an existing child node is modified.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#listen-child-changed.DatabaseQuery.observe(.childRemoved) / childEventsEmits childRemoved event whenever a child node is removed from the watched location.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#listen-child-removed.DatabaseQuery.removeObserver(withHandle:)Cancels the active observer or AsyncStream task and unsubscribes the worker listener.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#listen-cancel.Query Ordering, Filtering & Limits
DatabaseQuery.queryOrdered(byChild:)Orders query results by the value of the specified nested child key.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#query-order-by-child.DatabaseQuery.queryOrderedByKey()Orders query results lexicographically by child key name.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#query-order-by-key.DatabaseQuery.queryOrderedByValue()Orders query results by direct scalar node values.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#query-order-by-value.DatabaseQuery.queryEqual(toValue:childKey:)Filters query results to nodes matching the exact sort value and optional key.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#query-equal-to.DatabaseQuery.queryStarting(atValue:) / queryEnding(atValue:)Restricts query results to the inclusive lower and upper boundary values.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#query-range.DatabaseQuery.queryLimited(toFirst:) / queryLimited(toLast:)Caps query results to the first N or last N ordered child nodes.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#query-limit.Transactions & OnDisconnect
DatabaseReference.runTransactionBlock(_:)Executes optimistic concurrency transaction block on MutableData and commits upon success.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#tx-run.TransactionResult.abort()Aborts an in-progress transaction without writing changes to the database.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#tx-abort.DatabaseReference.onDisconnectSetValue(_:) / onDisconnectRemoveValue()Registers server-side write or removal operations to execute upon client disconnect.
FirebaseDatabase Swift specification. The Node host runs the operations when the client socket closes, by a close frame or after the host closes a socket that pinged and went silent, and keeps the session signed in for re-attach (ADR-0019):
packages/cli/test/serve/fixtures/hosted-sqlite-relay-ondisconnect.ts. The app scenario test/apps/host-closes-silent-consumer sends the same rtdb.onDisconnectSet from a paused node --import @pyric/cli/register process on a real dev server, and the host runs it once the liveness window passes. Swift test: packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#ondisconnect-set-remove.DatabaseReference.cancelDisconnectOperations()Cancels previously queued OnDisconnect operations at the reference path.
FirebaseDatabase Swift specification. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#ondisconnect-cancel.Current gaps
Documented divergences
Known differences between Pyric and production Firebase. Each remains tracked as a non-conforming row.
Database.database(url:)Returns a distinct Database handle for each database URL; production isolates the data and rules of each URL's database.
FirebaseDatabase Swift specification. The test asserts the handle carries its URL; bridge operations carry no instance field. Swift test:
packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#instance-url.reference(withPath: ".info") / reference(withPath: ".info/serverTimeOffset")Served by the client: .info is { connected, serverTimeOffset }, and serverTimeOffset is 0.
FirebaseDatabase Swift specification and ADR-0019 (amendment of 2026-10-16). The test asserts both values, null for another
.info key, and that none reaches the worker. Swift test: packages/swift-client/Tests/PyricDatabaseTests/RtdbConformanceTests.swift assertion set rtdb-swift#info-root-offset.