Skip to content

feat: Apple SDK update for version 14.1.0#99

Merged
abnegate merged 2 commits into
mainfrom
dev
Feb 12, 2026
Merged

feat: Apple SDK update for version 14.1.0#99
abnegate merged 2 commits into
mainfrom
dev

Conversation

@ChiragAgg5k
Copy link
Copy Markdown
Member

@ChiragAgg5k ChiragAgg5k commented Feb 12, 2026

This PR contains updates to the Apple SDK for version 14.1.0.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 12, 2026

Walkthrough

This pull request introduces significant changes to the Realtime subscription system, updates team member role handling, and removes an enum type. The Realtime.swift file is refactored to use slot-centric subscription state with per-slot query handling instead of global channel management. The subscription methods now accept an optional queries: [String] parameter. The Teams.swift file changes role parameter types from AppwriteEnums.Roles to plain strings in member operations. The Roles enum is removed from AppwriteEnums. Additionally, extensive documentation examples are updated with code fence formatting and client configuration snippets across 60+ files in the docs directory.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'feat: Apple SDK update for version 14.1.0' is a generic, high-level description that relates to the overall pull request but does not clearly highlight the main technical changes introduced in the changeset. Consider using a more specific title that captures the primary change, such as 'feat: refactor Realtime subscriptions with slot-based architecture' or 'feat: update Teams API to use string-based roles' to better convey the main objectives.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
docs/examples/databases/create-operations.md (1)

12-22: ⚠️ Potential issue | 🔴 Critical

Invalid Swift syntax in operations parameter.

The operations parameter uses JSON notation (curly braces {}) instead of Swift dictionary syntax (square brackets []). This code will not compile.

🐛 Proposed fix for Swift dictionary syntax
 let transaction = try await databases.createOperations(
     transactionId: "<TRANSACTION_ID>",
     operations: [
-	    {
+	    [
 	        "action": "create",
 	        "databaseId": "<DATABASE_ID>",
 	        "collectionId": "<COLLECTION_ID>",
 	        "documentId": "<DOCUMENT_ID>",
 	        "data": {
 	            "name": "Walter O'Brien"
 	        }
-	    }
+	    ]
 	] // optional
 )

Note: The nested data dictionary will also need to use Swift syntax: ["name": "Walter O'Brien"]

Sources/Appwrite/Services/Realtime.swift (1)

239-251: ⚠️ Potential issue | 🟠 Major

subCallDepth is read outside the connectSync queue — data race.

subCallDepth is incremented/decremented inside connectSync.sync (lines 240, 250) but read without synchronization on line 245. This can lead to a data race when multiple subscribe calls execute concurrently.

🐛 Proposed fix
-        if self.subCallDepth == 1 {
-            try await self.createSocket()
-        }
-
-        connectSync.sync {
-            self.subCallDepth -= 1
-        }
+        let shouldCreateSocket = connectSync.sync { () -> Bool in
+            let result = self.subCallDepth == 1
+            self.subCallDepth -= 1
+            return result
+        }
+
+        if shouldCreateSocket {
+            try await self.createSocket()
+        }
🤖 Fix all issues with AI agents
In `@docs/examples/locale/get.md`:
- Line 10: The example shadows the Locale service instance by assigning the
result of calling locale.get() back to the same name; rename the result variable
(e.g., localeResult or foundLocale) so it doesn't collide with the service
instance and update any subsequent references to use the new variable name when
working with the returned value from locale.get().

In `@Sources/Appwrite/Services/Realtime.swift`:
- Around line 370-375: The code force-unwraps data["timestamp"] when
constructing RealtimeResponseEvent (timestamp: data["timestamp"] as! String)
which can crash; change to a safe unwrap/cast (e.g., guard let timestamp =
data["timestamp"] as? String else { handle error/return } or provide a default)
and use that timestamp variable when building the RealtimeResponseEvent to match
the safe unwrapping pattern used for events/channels/payload.
🧹 Nitpick comments (2)
Sources/Appwrite/Services/Realtime.swift (1)

302-317: "connected" should be a named constant like the other message types.

TYPE_ERROR, TYPE_EVENT, and TYPE_PONG are defined as private constants (lines 8–10), but "connected" on line 309 is an inline string literal. Consider adding a TYPE_CONNECTED constant for consistency and to prevent typo-related bugs.

♻️ Proposed fix

Add at the top with the other constants:

 private let TYPE_PONG = "pong"
+private let TYPE_CONNECTED = "connected"

Then use it in the switch:

-        case "connected":
+        case TYPE_CONNECTED:
docs/examples/tablesdb/increment-row-column.md (1)

14-14: Consider using a placeholder like "<COLUMN>" instead of an empty string for column.

Other required parameters in this example (and across the docs) use the <PLACEHOLDER> convention (e.g., "<DATABASE_ID>"). An empty string for a required parameter could confuse users into thinking it's a valid value.

📝 Suggested change
-    column: "",
+    column: "<COLUMN>",

@@ -8,3 +9,4 @@ let locale = Locale(client)

let locale = try await locale.get()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix variable shadowing in the example.

Line 10 reuses the variable name locale, which shadows the Locale service instance declared on Line 8. This code would not compile.

🐛 Proposed fix
-let locale = try await locale.get()
+let userLocale = try await locale.get()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let locale = try await locale.get()
let userLocale = try await locale.get()
🤖 Prompt for AI Agents
In `@docs/examples/locale/get.md` at line 10, The example shadows the Locale
service instance by assigning the result of calling locale.get() back to the
same name; rename the result variable (e.g., localeResult or foundLocale) so it
doesn't collide with the service instance and update any subsequent references
to use the new variable name when working with the returned value from
locale.get().

Comment on lines +370 to +375
let response = RealtimeResponseEvent(
events: events,
channels: channels,
timestamp: data["timestamp"] as! String,
payload: payload
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Force-unwrap on timestamp will crash if the field is missing or has the wrong type.

Line 373 uses as! String which will cause a runtime crash if the backend omits timestamp or sends it as a non-string type. All other fields in this guard block are safely unwrapped — timestamp should be too.

🐛 Proposed fix
-                    let response = RealtimeResponseEvent(
-                        events: events,
-                        channels: channels,
-                        timestamp: data["timestamp"] as! String,
-                        payload: payload
-                    )
-                    subscription.callback(response)
+                    if let timestamp = data["timestamp"] as? String {
+                        let response = RealtimeResponseEvent(
+                            events: events,
+                            channels: channels,
+                            timestamp: timestamp,
+                            payload: payload
+                        )
+                        subscription.callback(response)
+                    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let response = RealtimeResponseEvent(
events: events,
channels: channels,
timestamp: data["timestamp"] as! String,
payload: payload
)
if let timestamp = data["timestamp"] as? String {
let response = RealtimeResponseEvent(
events: events,
channels: channels,
timestamp: timestamp,
payload: payload
)
subscription.callback(response)
}
🤖 Prompt for AI Agents
In `@Sources/Appwrite/Services/Realtime.swift` around lines 370 - 375, The code
force-unwraps data["timestamp"] when constructing RealtimeResponseEvent
(timestamp: data["timestamp"] as! String) which can crash; change to a safe
unwrap/cast (e.g., guard let timestamp = data["timestamp"] as? String else {
handle error/return } or provide a default) and use that timestamp variable when
building the RealtimeResponseEvent to match the safe unwrapping pattern used for
events/channels/payload.

@ChiragAgg5k ChiragAgg5k changed the title feat: Apple SDK update for version 14.0.0 feat: Apple SDK update for version 14.1.0 Feb 12, 2026
@abnegate abnegate merged commit 3df582f into main Feb 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants