@cometchat/skills 4.2.1 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +33 -12
  3. package/bin/install.js +59 -4
  4. package/package.json +14 -1
  5. package/skills/cometchat/SKILL.md +460 -77
  6. package/skills/cometchat/references/asking-questions.md +48 -0
  7. package/skills/cometchat-a11y/SKILL.md +3 -2
  8. package/skills/cometchat-android-v5/SKILL.md +2 -1
  9. package/skills/cometchat-android-v5-calls/SKILL.md +36 -22
  10. package/skills/cometchat-android-v5-calls/references/README.md +1 -1
  11. package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +7 -5
  12. package/skills/cometchat-android-v5-calls/references/audio-controls.md +4 -4
  13. package/skills/cometchat-android-v5-calls/references/call-layouts.md +33 -25
  14. package/skills/cometchat-android-v5-calls/references/call-session.md +2 -2
  15. package/skills/cometchat-android-v5-calls/references/custom-ui.md +5 -5
  16. package/skills/cometchat-android-v5-calls/references/event-listeners.md +2 -2
  17. package/skills/cometchat-android-v5-calls/references/idle-timeout.md +20 -14
  18. package/skills/cometchat-android-v5-calls/references/in-call-chat.md +1 -1
  19. package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +43 -27
  20. package/skills/cometchat-android-v5-calls/references/participant-management.md +3 -3
  21. package/skills/cometchat-android-v5-calls/references/raise-hand.md +25 -19
  22. package/skills/cometchat-android-v5-calls/references/recording.md +2 -2
  23. package/skills/cometchat-android-v5-calls/references/ringing-integration.md +1 -1
  24. package/skills/cometchat-android-v5-calls/references/screen-sharing.md +5 -9
  25. package/skills/cometchat-android-v5-calls/references/session-settings.md +3 -3
  26. package/skills/cometchat-android-v5-calls/references/setup.md +1 -1
  27. package/skills/cometchat-android-v5-calls/references/share-invite.md +9 -4
  28. package/skills/cometchat-android-v5-calls/references/video-controls.md +4 -4
  29. package/skills/cometchat-android-v5-calls/references/voip-calling.md +2 -2
  30. package/skills/cometchat-android-v5-components/SKILL.md +4 -3
  31. package/skills/cometchat-android-v5-core/SKILL.md +20 -2
  32. package/skills/cometchat-android-v5-customization/SKILL.md +171 -7
  33. package/skills/cometchat-android-v5-extensions/SKILL.md +7 -4
  34. package/skills/cometchat-android-v5-features/SKILL.md +5 -4
  35. package/skills/cometchat-android-v5-placement/SKILL.md +2 -1
  36. package/skills/cometchat-android-v5-production/SKILL.md +2 -1
  37. package/skills/cometchat-android-v5-push/SKILL.md +2 -3
  38. package/skills/cometchat-android-v5-testing/SKILL.md +2 -1
  39. package/skills/cometchat-android-v5-theming/SKILL.md +2 -1
  40. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +3 -2
  41. package/skills/cometchat-android-v6/SKILL.md +2 -1
  42. package/skills/cometchat-android-v6-builder-settings/SKILL.md +11 -7
  43. package/skills/cometchat-android-v6-calls/SKILL.md +79 -18
  44. package/skills/cometchat-android-v6-calls/references/advanced-features.md +87 -0
  45. package/skills/cometchat-android-v6-calls/references/call-layouts.md +24 -15
  46. package/skills/cometchat-android-v6-calls/references/call-session.md +2 -2
  47. package/skills/cometchat-android-v6-calls/references/device-management.md +17 -16
  48. package/skills/cometchat-android-v6-calls/references/idle-timeout.md +7 -4
  49. package/skills/cometchat-android-v6-calls/references/in-call-chat.md +13 -8
  50. package/skills/cometchat-android-v6-calls/references/raise-hand.md +6 -4
  51. package/skills/cometchat-android-v6-compose-components/SKILL.md +52 -29
  52. package/skills/cometchat-android-v6-compose-customization/SKILL.md +156 -1
  53. package/skills/cometchat-android-v6-compose-placement/SKILL.md +129 -40
  54. package/skills/cometchat-android-v6-compose-theming/SKILL.md +27 -1
  55. package/skills/cometchat-android-v6-core/SKILL.md +389 -9
  56. package/skills/cometchat-android-v6-events/SKILL.md +4 -1
  57. package/skills/cometchat-android-v6-extensions/SKILL.md +2 -1
  58. package/skills/cometchat-android-v6-features/SKILL.md +26 -2
  59. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +31 -1
  60. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +172 -1
  61. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +20 -5
  62. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +36 -5
  63. package/skills/cometchat-android-v6-migration/SKILL.md +44 -42
  64. package/skills/cometchat-android-v6-production/SKILL.md +6 -3
  65. package/skills/cometchat-android-v6-push/SKILL.md +43 -2
  66. package/skills/cometchat-android-v6-testing/SKILL.md +11 -8
  67. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +26 -5
  68. package/skills/cometchat-angular-calls/SKILL.md +256 -389
  69. package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +3 -2
  70. package/skills/cometchat-angular-calls/references/call-layouts.md +29 -12
  71. package/skills/cometchat-angular-calls/references/call-session.md +2 -2
  72. package/skills/cometchat-angular-calls/references/custom-ui.md +18 -10
  73. package/skills/cometchat-angular-calls/references/device-management.md +53 -34
  74. package/skills/cometchat-angular-calls/references/group-calls.md +45 -24
  75. package/skills/cometchat-angular-calls/references/idle-timeout.md +31 -15
  76. package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +7 -6
  77. package/skills/cometchat-angular-calls/references/raise-hand.md +9 -4
  78. package/skills/cometchat-angular-calls/references/recording-screen-share.md +32 -39
  79. package/skills/cometchat-angular-calls/references/ringing-integration.md +3 -1
  80. package/skills/cometchat-angular-calls/references/share-invite.md +11 -5
  81. package/skills/cometchat-angular-calls/references/virtual-background.md +29 -0
  82. package/skills/cometchat-angular-components/SKILL.md +149 -620
  83. package/skills/cometchat-angular-core/SKILL.md +235 -293
  84. package/skills/cometchat-angular-customization/SKILL.md +415 -223
  85. package/skills/cometchat-angular-features/SKILL.md +216 -334
  86. package/skills/cometchat-angular-patterns/SKILL.md +168 -359
  87. package/skills/cometchat-angular-placement/SKILL.md +189 -560
  88. package/skills/cometchat-angular-production/SKILL.md +241 -92
  89. package/skills/cometchat-angular-push/SKILL.md +280 -294
  90. package/skills/cometchat-angular-testing/SKILL.md +430 -158
  91. package/skills/cometchat-angular-theming/SKILL.md +190 -265
  92. package/skills/cometchat-angular-troubleshooting/SKILL.md +192 -157
  93. package/skills/cometchat-astro-patterns/SKILL.md +22 -1
  94. package/skills/cometchat-calls/SKILL.md +25 -19
  95. package/skills/cometchat-calls/references/use-case-broadcast.md +15 -10
  96. package/skills/cometchat-calls/references/use-case-marketplace.md +2 -3
  97. package/skills/cometchat-calls/references/use-case-support.md +3 -4
  98. package/skills/cometchat-calls/references/use-case-team.md +23 -12
  99. package/skills/cometchat-calls/references/use-case-telehealth.md +3 -4
  100. package/skills/cometchat-components/SKILL.md +163 -25
  101. package/skills/cometchat-core/SKILL.md +412 -13
  102. package/skills/cometchat-customization/SKILL.md +50 -25
  103. package/skills/cometchat-features/SKILL.md +313 -34
  104. package/skills/cometchat-flutter-v5/SKILL.md +10 -4
  105. package/skills/cometchat-flutter-v5-calls/SKILL.md +188 -158
  106. package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +48 -24
  107. package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +20 -15
  108. package/skills/cometchat-flutter-v5-calls/references/call-session.md +100 -145
  109. package/skills/cometchat-flutter-v5-calls/references/device-management.md +12 -8
  110. package/skills/cometchat-flutter-v5-calls/references/group-calls.md +30 -36
  111. package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +15 -13
  112. package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +12 -9
  113. package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +115 -65
  114. package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +41 -30
  115. package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +17 -14
  116. package/skills/cometchat-flutter-v5-calls/references/share-invite.md +8 -2
  117. package/skills/cometchat-flutter-v5-conversations/SKILL.md +2 -1
  118. package/skills/cometchat-flutter-v5-core/SKILL.md +20 -2
  119. package/skills/cometchat-flutter-v5-customization/SKILL.md +136 -5
  120. package/skills/cometchat-flutter-v5-events/SKILL.md +2 -1
  121. package/skills/cometchat-flutter-v5-messages/SKILL.md +2 -1
  122. package/skills/cometchat-flutter-v5-production/SKILL.md +15 -6
  123. package/skills/cometchat-flutter-v5-push/SKILL.md +2 -1
  124. package/skills/cometchat-flutter-v5-testing/SKILL.md +17 -6
  125. package/skills/cometchat-flutter-v5-theming/SKILL.md +2 -1
  126. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +7 -6
  127. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +3 -2
  128. package/skills/cometchat-flutter-v6/SKILL.md +17 -16
  129. package/skills/cometchat-flutter-v6-calls/SKILL.md +78 -63
  130. package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +8 -6
  131. package/skills/cometchat-flutter-v6-calls/references/advanced-features.md +89 -0
  132. package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +15 -12
  133. package/skills/cometchat-flutter-v6-calls/references/call-session.md +2 -2
  134. package/skills/cometchat-flutter-v6-calls/references/device-management.md +9 -3
  135. package/skills/cometchat-flutter-v6-calls/references/group-calls.md +10 -10
  136. package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +15 -7
  137. package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +6 -3
  138. package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +23 -16
  139. package/skills/cometchat-flutter-v6-components/SKILL.md +32 -11
  140. package/skills/cometchat-flutter-v6-conversations/SKILL.md +39 -11
  141. package/skills/cometchat-flutter-v6-core/SKILL.md +348 -10
  142. package/skills/cometchat-flutter-v6-customization/SKILL.md +97 -25
  143. package/skills/cometchat-flutter-v6-events/SKILL.md +3 -2
  144. package/skills/cometchat-flutter-v6-features/SKILL.md +15 -6
  145. package/skills/cometchat-flutter-v6-messages/SKILL.md +111 -60
  146. package/skills/cometchat-flutter-v6-migration/SKILL.md +18 -25
  147. package/skills/cometchat-flutter-v6-placement/SKILL.md +79 -50
  148. package/skills/cometchat-flutter-v6-production/SKILL.md +13 -12
  149. package/skills/cometchat-flutter-v6-push/SKILL.md +43 -21
  150. package/skills/cometchat-flutter-v6-testing/SKILL.md +6 -6
  151. package/skills/cometchat-flutter-v6-theming/SKILL.md +38 -5
  152. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +182 -17
  153. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +12 -4
  154. package/skills/cometchat-i18n/SKILL.md +139 -78
  155. package/skills/cometchat-ios/SKILL.md +4 -2
  156. package/skills/cometchat-ios-calls/SKILL.md +225 -95
  157. package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +11 -9
  158. package/skills/cometchat-ios-calls/references/audio-modes-and-controls.md +45 -0
  159. package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +6 -7
  160. package/skills/cometchat-ios-calls/references/call-layouts.md +31 -91
  161. package/skills/cometchat-ios-calls/references/call-session.md +51 -54
  162. package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +33 -29
  163. package/skills/cometchat-ios-calls/references/custom-ui.md +38 -38
  164. package/skills/cometchat-ios-calls/references/group-calls.md +33 -70
  165. package/skills/cometchat-ios-calls/references/idle-timeout.md +24 -25
  166. package/skills/cometchat-ios-calls/references/in-call-chat.md +19 -23
  167. package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +128 -70
  168. package/skills/cometchat-ios-calls/references/picture-in-picture.md +20 -20
  169. package/skills/cometchat-ios-calls/references/raise-hand.md +14 -227
  170. package/skills/cometchat-ios-calls/references/recording-screen-share.md +35 -122
  171. package/skills/cometchat-ios-calls/references/ringing-integration.md +17 -16
  172. package/skills/cometchat-ios-calls/references/share-invite.md +8 -12
  173. package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +4 -4
  174. package/skills/cometchat-ios-components/SKILL.md +200 -12
  175. package/skills/cometchat-ios-core/SKILL.md +281 -11
  176. package/skills/cometchat-ios-customization/SKILL.md +276 -110
  177. package/skills/cometchat-ios-features/SKILL.md +64 -36
  178. package/skills/cometchat-ios-placement/SKILL.md +15 -12
  179. package/skills/cometchat-ios-production/SKILL.md +12 -4
  180. package/skills/cometchat-ios-push/SKILL.md +53 -19
  181. package/skills/cometchat-ios-testing/SKILL.md +14 -9
  182. package/skills/cometchat-ios-theming/SKILL.md +39 -3
  183. package/skills/cometchat-ios-troubleshooting/SKILL.md +41 -21
  184. package/skills/cometchat-native-bare-patterns/SKILL.md +56 -18
  185. package/skills/cometchat-native-calls/SKILL.md +89 -19
  186. package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +2 -2
  187. package/skills/cometchat-native-calls/references/call-layouts.md +15 -14
  188. package/skills/cometchat-native-calls/references/call-session.md +2 -2
  189. package/skills/cometchat-native-calls/references/custom-ui.md +12 -8
  190. package/skills/cometchat-native-calls/references/device-management.md +53 -30
  191. package/skills/cometchat-native-calls/references/group-calls.md +35 -30
  192. package/skills/cometchat-native-calls/references/idle-timeout.md +6 -6
  193. package/skills/cometchat-native-calls/references/in-call-chat.md +10 -8
  194. package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +2 -2
  195. package/skills/cometchat-native-calls/references/raise-hand.md +15 -13
  196. package/skills/cometchat-native-calls/references/recording-screen-share.md +49 -170
  197. package/skills/cometchat-native-calls/references/share-invite.md +7 -5
  198. package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +4 -2
  199. package/skills/cometchat-native-components/SKILL.md +91 -57
  200. package/skills/cometchat-native-core/SKILL.md +281 -9
  201. package/skills/cometchat-native-customization/SKILL.md +150 -28
  202. package/skills/cometchat-native-expo-patterns/SKILL.md +77 -27
  203. package/skills/cometchat-native-features/SKILL.md +79 -49
  204. package/skills/cometchat-native-placement/SKILL.md +19 -10
  205. package/skills/cometchat-native-production/SKILL.md +9 -3
  206. package/skills/cometchat-native-push/SKILL.md +2 -1
  207. package/skills/cometchat-native-testing/SKILL.md +1 -2
  208. package/skills/cometchat-native-theming/SKILL.md +54 -29
  209. package/skills/cometchat-native-troubleshooting/SKILL.md +71 -3
  210. package/skills/cometchat-nextjs-patterns/SKILL.md +48 -6
  211. package/skills/cometchat-placement/SKILL.md +42 -3
  212. package/skills/cometchat-production/SKILL.md +12 -5
  213. package/skills/cometchat-react-calls/SKILL.md +220 -10
  214. package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +4 -3
  215. package/skills/cometchat-react-calls/references/call-layouts.md +5 -6
  216. package/skills/cometchat-react-calls/references/call-session.md +1 -1
  217. package/skills/cometchat-react-calls/references/custom-ui.md +61 -15
  218. package/skills/cometchat-react-calls/references/device-management.md +55 -51
  219. package/skills/cometchat-react-calls/references/group-calls.md +18 -23
  220. package/skills/cometchat-react-calls/references/idle-timeout.md +25 -12
  221. package/skills/cometchat-react-calls/references/in-call-chat.md +7 -7
  222. package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +9 -11
  223. package/skills/cometchat-react-calls/references/raise-hand.md +14 -14
  224. package/skills/cometchat-react-calls/references/recording-screen-share.md +39 -38
  225. package/skills/cometchat-react-calls/references/ringing-integration.md +2 -2
  226. package/skills/cometchat-react-calls/references/share-invite.md +4 -5
  227. package/skills/cometchat-react-calls/references/testing-calls-on-web.md +20 -2
  228. package/skills/cometchat-react-calls/references/virtual-background.md +32 -0
  229. package/skills/cometchat-react-patterns/SKILL.md +57 -4
  230. package/skills/cometchat-react-push/SKILL.md +258 -72
  231. package/skills/cometchat-react-router-patterns/SKILL.md +43 -4
  232. package/skills/cometchat-react-testing/SKILL.md +14 -5
  233. package/skills/cometchat-theming/SKILL.md +181 -18
  234. package/skills/cometchat-troubleshooting/SKILL.md +40 -20
@@ -3,13 +3,14 @@ name: cometchat-ios-core
3
3
  description: "Shared rules for CometChat iOS UI Kit v5. Always loaded alongside placement skills. Read this first."
4
4
  license: "MIT"
5
5
  compatibility: "iOS 13+; Swift 5.0+; CometChatUIKitSwift ^5; CometChatSDK ^4"
6
- allowed-tools: "shell, file-read, file-search, file-list"
7
6
  metadata:
8
7
  author: "CometChat"
9
8
  version: "3.0.0"
10
9
  tags: "chat cometchat ios swift core rules initialization patterns"
11
10
  ---
12
11
 
12
+ > **Ground truth:** `CometChatUIKitSwift ~> 5` + `CometChatSDK ~> 4` (+ `CometChatCallsSDK ~> 5`) — the installed Pods / SPM `.swiftinterface` + `docs/ui-kit/ios`. **Official docs:** https://www.cometchat.com/docs/ui-kit/ios/overview · **Docs MCP:** `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp` (or fetch the URL directly without MCP). Verify Swift symbols/labels against the `.swiftinterface` before relying on them.
13
+
13
14
  ## Purpose
14
15
 
15
16
  This is the foundational skill for every CometChat iOS UI Kit v5 integration. It teaches HOW CometChat works on iOS — initialization, login, the manager pattern, and anti-patterns — so you can write project-appropriate code instead of relying on templates.
@@ -134,7 +135,7 @@ https://github.com/cometchat/chat-sdk-ios
134
135
 
135
136
  **CometChat Calls SDK (for voice/video calls):**
136
137
  ```
137
- https://github.com/cometchat/cometchat-calls-sdk-ios
138
+ https://github.com/cometchat/calls-sdk-ios
138
139
  ```
139
140
 
140
141
  Or add to `Package.swift`:
@@ -142,7 +143,7 @@ Or add to `Package.swift`:
142
143
  dependencies: [
143
144
  .package(url: "https://github.com/cometchat/cometchat-uikit-ios", from: "5.0.0"),
144
145
  // Optional: Add calls SDK for voice/video
145
- // .package(url: "https://github.com/cometchat/cometchat-calls-sdk-ios", from: "4.0.0")
146
+ // .package(url: "https://github.com/cometchat/calls-sdk-ios", from: "5.0.0") // requires iOS 16+
146
147
  ]
147
148
  ```
148
149
 
@@ -152,7 +153,7 @@ dependencies: [
152
153
  |---------|------------|-------------|
153
154
  | UI Kit | https://github.com/cometchat/cometchat-uikit-ios | Ready-to-use UI components |
154
155
  | Chat SDK | https://github.com/cometchat/chat-sdk-ios | Core messaging SDK |
155
- | Calls SDK | https://github.com/cometchat/cometchat-calls-sdk-ios | Voice & video calling |
156
+ | Calls SDK | https://github.com/cometchat/calls-sdk-ios | Voice & video calling |
156
157
  | Sample App | https://github.com/cometchat/cometchat-sample-app-ios | Sample implementation |
157
158
 
158
159
  ---
@@ -161,7 +162,62 @@ dependencies: [
161
162
 
162
163
  CometChat must be initialized exactly once before any UI component is used. Initialization is asynchronous and must complete fully before mounting any `CometChat*` view controller.
163
164
 
164
- ### UIKitSettings Builder
165
+ ### File-based init with `cometchat-settings.json` (recommended)
166
+
167
+ > **Version requirement (ENG-35866 — Skills Telemetry).** `CometChatUIKit.initFromSettings(completion:)` reads a bundled `cometchat-settings.json` and lets the SDK self-report `integrationSource = "ai-agent"` to `/user_sessions`. It ships GA in **`CometChatUIKitSwift >= 5.1.15`** (public CocoaPods + SPM; pulls `CometChatSDK 4.1.x`). The `~> 5.1` Pod range / `from: "5.0.0"` SPM range below already resolve it. On an older UI Kit (`< 5.1.15`) the method does not exist — use the **`UIKitSettings` builder fallback** below.
168
+
169
+ Unlike the web/RN kits, the iOS `initFromSettings` takes **no settings argument** — it reads the file straight from the app bundle, so the file must be added to the target's **Copy Bundle Resources**.
170
+
171
+ **Step 1 — create `cometchat-settings.json`** and add it to the app target (`File → Add Files…`, *and* confirm it appears under *Build Phases → Copy Bundle Resources*). Fill `appId` / `region` / `credentials.authKey`; leave the rest at the defaults:
172
+
173
+ ```json
174
+ {
175
+ "appId": "APP_ID_HERE",
176
+ "region": "us",
177
+ "credentials": {
178
+ "authKey": "AUTH_KEY_HERE"
179
+ },
180
+ "chatSDK": {
181
+ "presenceSubscription": {
182
+ "type": "ALL_USERS",
183
+ "roles": []
184
+ },
185
+ "autoEstablishSocketConnection": true,
186
+ "adminHost": null,
187
+ "clientHost": null
188
+ },
189
+ "callsSDK": {
190
+ "host": null,
191
+ "adminHost": null,
192
+ "clientHost": null,
193
+ "callsHost": null
194
+ },
195
+ "uiKit": {
196
+ "subscribePresenceForAllUsers": true
197
+ }
198
+ }
199
+ ```
200
+
201
+ **Step 2 — init (no builder, no args — the SDK reads the bundled file):**
202
+
203
+ ```swift
204
+ // initFromSettings ships GA in CometChatUIKitSwift >= 5.1.15 (ENG-35866)
205
+ import CometChatUIKitSwift
206
+
207
+ CometChatUIKit.initFromSettings { success, error in
208
+ if let error = error {
209
+ print("CometChat init failed: \(error.errorCode) — \(error.errorDescription)")
210
+ return
211
+ }
212
+ print("CometChat initialized")
213
+ // then: CometChatUIKit.login(uid:) — see §3
214
+ }
215
+ ```
216
+
217
+ - If init throws `cometchat-settings.json not found`, the file isn't in **Copy Bundle Resources** — add it there (adding it to the project navigator alone is not enough).
218
+ - **Do NOT gitignore `cometchat-settings.json`.** The dev-mode `authKey` ships in the app bundle either way; production uses server-minted auth tokens.
219
+
220
+ ### UIKitSettings Builder (fallback — UI Kit before file-based init)
165
221
 
166
222
  ```swift
167
223
  import CometChatUIKitSwift
@@ -224,6 +280,8 @@ final class CometChatManager {
224
280
 
225
281
  ### Init in AppDelegate (UIKit apps)
226
282
 
283
+ > **Scene-based app (the modern Xcode default — has a `SceneDelegate.swift`)?** Init in `scene(_:willConnectTo:)` instead — that's the canonical pattern the reference app uses (see "Init code — SceneDelegate (canonical)" below). The `didFinishLaunchingWithOptions` example here is correct for the **SDK init call itself** (it needs no window), but scene-based apps that load settings + apply theme + set the root view controller in one pass should do all of it in `scene(_:willConnectTo:)`, where the window/scene exists. Use this AppDelegate form only for apps with no SceneDelegate.
284
+
227
285
  ```swift
228
286
  import UIKit
229
287
  import CometChatUIKitSwift
@@ -365,7 +423,8 @@ CometChat uses `CometChatException` for errors. **Important:** Use `errorDescrip
365
423
  // CometChatException has these properties:
366
424
  error.errorCode // String - error code like "ERR_UID_NOT_FOUND"
367
425
  error.errorDescription // String - human-readable description
368
- error.details // [String: Any]? - additional details
426
+ // NOTE: CometChatException exposes ONLY errorCode + errorDescription.
427
+ // There is no `details` property — don't reference one.
369
428
  ```
370
429
 
371
430
  ### Correct Error Handling
@@ -679,11 +738,16 @@ CometChatConversations.style.titleColor = .label
679
738
  // Message list style
680
739
  CometChatMessageList.style.backgroundColor = .systemBackground
681
740
 
682
- // Avatar style — cornerRadius is a CGFloat on a CometChatCornerStyle,
683
- // NOT a `.circle` enum case. Use a value larger than half the avatar
684
- // dimension for a circular look.
741
+ // Avatar style — cornerRadius is a CometChatCornerStyle. Its only value-
742
+ // taking init is the labeled designated init (the bare
743
+ // `CometChatCornerStyle(cornerRadius:)` belongs to the sibling
744
+ // CometChatCorner struct and will NOT compile here). Pass a value larger
745
+ // than half the avatar dimension for a circular look.
685
746
  CometChatAvatar.style.backgroundColor = .systemGray5
686
- CometChatAvatar.style.cornerRadius = CometChatCornerStyle(cornerRadius: 100)
747
+ CometChatAvatar.style.cornerRadius = CometChatCornerStyle(
748
+ topLeft: true, topRight: true, bottomLeft: true, bottomRight: true,
749
+ cornerRadius: 100
750
+ )
687
751
  ```
688
752
 
689
753
  ### Dark Mode Support
@@ -816,7 +880,213 @@ This automatically includes:
816
880
  For voice/video calls, add:
817
881
 
818
882
  ```ruby
819
- pod 'CometChatCallsSDK', '~> 4.0'
883
+ pod 'CometChatCallsSDK', '~> 5.0' # requires iOS 16+ deployment target
820
884
  ```
821
885
 
822
886
  The UI Kit automatically detects and enables calling features when the Calls SDK is present.
887
+
888
+ ## Visual Builder integration
889
+
890
+ When the dispatcher's Step 3.1 sets `customize=visual` and the platform resolves to `ios`, skills runs **`cometchat builder export --platform ios`** — a single CLI command that downloads the canonical static template ZIP from `preview.cometchat.com/downloads/cometchat-builder-ios.zip`, fetches the per-builder settings JSON, applies F3 + F10 missing-field defaults, and writes 3 files to `--output` (default: `CometChat/`):
891
+
892
+ - `MessagesVC.swift` — verbatim view controller composing header + list + composer
893
+ - `ThreadedMessagesVC.swift` — verbatim helper VC (imported by MessagesVC)
894
+ - `cometchat-builder-settings.json` — **envelope-shape JSON** `{ builderId, settings: {...} }` (the iOS canonical has no top-level `name`; `CometChatBuilderSettings.loadFromJSON()` reads only `settings.*`) (no sentinel — JSON forbids `//` comments)
895
+
896
+ > ℹ️ **Version-history note (ENG-35337) — RESOLVED end-to-end; `pod 'CometChatBuilder'` (1.1.2) builds AND launches.** A freshly-exported iOS builder ZIP was built end-to-end (`pod 'CometChatBuilder'` unversioned → resolves 1.1.2, with CometChatUIKitSwift 5.1.13 / CometChatSDK 4.1.3 / CometChatCallsSDK 5.0.0) → **`BUILD SUCCEEDED`**, then **installed + launched clean on a physical iPhone** (verified 2026-06-17 — the earlier sim-only `EXCLUDED_ARCHS` quirk was an environment issue, not a project defect). The current `ThreadedMessagesVC.swift` no longer reads `CometChatBuilderSettings.shared.layout.compactMessageComposer` (grep-confirmed absent), so the older compile failure is gone — do NOT pin `> 1.1.2` (a `1.1.3` may not exist; pinning it would break `pod install`). **Only if** you have an OLDER export whose `ThreadedMessagesVC.swift` still references `.layout.compactMessageComposer` and you hit `"value of type 'Layout' has no member 'compactMessageComposer'"`, re-export from the dashboard (preferred) or pin a newer `CometChatBuilder` if one is published.
897
+
898
+ ### 1. Run `cometchat builder export`
899
+
900
+ ```bash
901
+ cometchat builder export --platform ios --json
902
+ ```
903
+
904
+ Defaults to `--output CometChat/`. Adjust the output if the customer's project uses a different chat-surface group name (e.g. `--output Chat/` for projects that use a `Chat` group).
905
+
906
+ `CometChatBuilderSettings.loadFromJSON()` looks for the envelope shape — handing it the raw settings blob causes `CometChatBuilderSettings.shared` to fall back to defaults silently (no error logged). The CLI always writes the envelope, so this trap is closed.
907
+
908
+ Resync = re-run the same command with `--force`. See `cometchat-core` §11.6 for the resync contract.
909
+
910
+ ### 2. Files skills writes (after `builder export`)
911
+
912
+ | Path | Content |
913
+ |---|---|
914
+ | `CometChat/CometChatApp.swift` | **Optional, SwiftUI-host only.** Skills-authored convenience wrapper that mounts `CometChatConversations` + pushes `MessagesVC` on tap. Feature flags read from `CometChatBuilderSettings.shared`. Skills emits this — not from the ZIP. The canonical (reference-app) entry is the UIKit SceneDelegate → `FrameworkManager` → `HomeScreenViewController` path, not this wrapper. |
915
+
916
+ ### Files patched
917
+
918
+ | Path | Patch |
919
+ |---|---|
920
+ | `Podfile` | Add `pod 'CometChatBuilder', '> 1.1.2'` (the canonical pod surfacing `CometChatBuilderSettings.shared` + `loadFromJSON()`; **pin `> 1.1.2`** — ≤1.1.2 lacks `Layout.compactMessageComposer` and fails to compile, see the build-breaker caveat above). Add `pod 'CometChatUIKitSwift', '~> 5.1'` if not already declared. SPM equivalent: `.package(url: "https://github.com/cometchat/cometchat-builder-ios", from: "1.1.3")` |
921
+ | `SceneDelegate.swift` (UIKit — canonical) / `App.swift` (SwiftUI — alternative) | Add `CometChatBuilderSettings.loadFromJSON()` + theme application + `CometChatUIKit.init(uiKitSettings:)`. **For scene-based apps (the reference app and any project with a `SceneDelegate`), init in `scene(_:willConnectTo:)` — NOT in `AppDelegate.didFinishLaunchingWithOptions`** (that runs before the scene/window exists). See init code below |
922
+ | App target | Toggle `cometchat-builder-settings.json` for **target membership** in Xcode (else `loadFromJSON()` silently returns defaults) |
923
+ | Entry view — root `UIViewController` (UIKit) / `ContentView.swift` (SwiftUI) | Mount the chat surface per Step 3c placement (modal sheet, push-navigation destination, tab item, or embedded view) |
924
+ | `Info.plist` | `NSMicrophoneUsageDescription` + `NSCameraUsageDescription` if `CometChatBuilderSettings.shared.callFeatures` has any enabled feature |
925
+
926
+ ### Init code — SceneDelegate (canonical)
927
+
928
+ The reference app (`CometChatBuilderSwift`) is **pure UIKit, scene-based**: `@main AppDelegate` does nothing but vend the scene configuration, and `SceneDelegate.scene(_:willConnectTo:)` calls into a `FrameworkManager.initialize(with:completion:)` helper that loads settings → applies theme → inits the kit. Mirror that — do **not** init in `AppDelegate.didFinishLaunchingWithOptions` for a scene-based app (the window/scene doesn't exist yet there).
929
+
930
+ ```swift
931
+ // SceneDelegate.swift
932
+ import UIKit
933
+ import CometChatBuilder
934
+
935
+ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
936
+ var window: UIWindow?
937
+
938
+ func scene(_ scene: UIScene,
939
+ willConnectTo session: UISceneSession,
940
+ options connectionOptions: UIScene.ConnectionOptions) {
941
+ guard (scene as? UIWindowScene) != nil else { return }
942
+ FrameworkManager.initialize(with: scene) {
943
+ print("Framework initialized ✅")
944
+ }
945
+ }
946
+ }
947
+ ```
948
+
949
+ ```swift
950
+ // FrameworkManager.swift — load settings → applyTheme → init kit
951
+ import UIKit
952
+ import CometChatUIKitSwift
953
+ import CometChatSDK
954
+ import CometChatBuilder
955
+
956
+ enum FrameworkManager {
957
+ static func initialize(with scene: UIScene, completion: @escaping () -> Void) {
958
+ // 1. Load builder settings from bundled JSON
959
+ CometChatBuilderSettings.loadFromJSON()
960
+
961
+ // 2. Apply builder theme tokens to the kit's global theme
962
+ applyTheme()
963
+
964
+ // 3. Standard UI Kit init (this file's §2 — credentials from Secrets.swift)
965
+ let settings = UIKitSettings()
966
+ .set(appID: Secrets.appID)
967
+ .set(authKey: Secrets.authKey)
968
+ .set(region: Secrets.region)
969
+ .subscribePresenceForAllUsers()
970
+ .build()
971
+ CometChatUIKit.init(uiKitSettings: settings) { _ in
972
+ // set the root view controller on `scene` here, then:
973
+ completion()
974
+ }
975
+ }
976
+
977
+ static func applyTheme() {
978
+ let color = CometChatBuilderSettings.shared.style.color
979
+ CometChatTheme.primaryColor = UIColor.dynamicColor(
980
+ lightModeColor: UIColor(hex: color.brandColor),
981
+ darkModeColor: UIColor(hex: color.brandColor)
982
+ )
983
+ CometChatTheme.textColorPrimary = UIColor.dynamicColor(
984
+ lightModeColor: UIColor(hex: color.primaryTextLight),
985
+ darkModeColor: UIColor(hex: color.primaryTextDark)
986
+ )
987
+ CometChatTheme.textColorSecondary = UIColor.dynamicColor(
988
+ lightModeColor: UIColor(hex: color.secondaryTextLight),
989
+ darkModeColor: UIColor(hex: color.secondaryTextDark)
990
+ )
991
+ // ⚠️ Map the builder's raw font label to a registered PostScript name
992
+ // BEFORE handing it to setFont — passing the raw value (e.g. "Roboto")
993
+ // does NOT resolve to a real font and silently falls back to the system font.
994
+ let rawFont = CometChatBuilderSettings.shared.style.typography.font
995
+ CometChatTypography.setFont(name: fontName(rawFont) ?? "")
996
+ }
997
+
998
+ /// Resolves a builder font label to its registered PostScript name.
999
+ /// (Verbatim from the reference app's FrameworkManager.fontName.)
1000
+ static func fontName(_ name: String) -> String? {
1001
+ switch name.lowercased() {
1002
+ case "times new roman": return "TimesNewRomanPSMT"
1003
+ case "arial": return "ArialMT"
1004
+ case "roboto": return "Roboto-Regular"
1005
+ case "inter": return "Inter-Regular"
1006
+ default: return "\(name.capitalized)-Regular"
1007
+ }
1008
+ }
1009
+ }
1010
+ ```
1011
+
1012
+ > **Font trap (D4).** `style.typography.font` in the builder JSON is a human label like `"Roboto"` or `"Arial"` — **not** a PostScript font name. Passing it straight to `CometChatTypography.setFont(name:)` (e.g. `setFont(name: settings.style.typography.font)`) silently fails to load the font. Always route it through the `fontName(_:)` lookup above (or otherwise resolve to a registered PostScript name, and register any custom `.ttf`/`.otf` in `Info.plist` under `UIAppFonts`).
1013
+
1014
+ `loadFromJSON()` reads `cometchat-builder-settings.json` from the main bundle. If the file isn't a target member (Xcode → file inspector → Target Membership), `CometChatBuilderSettings.shared` silently falls back to defaults — this is the #1 integration bug. Sanity-check by printing `CometChatBuilderSettings.shared.style.color.brandColor` after `loadFromJSON()`.
1015
+
1016
+ ### The wrapper template (SwiftUI convenience — optional)
1017
+
1018
+ `CometChatApp.swift` below is a **skills-authored convenience wrapper** for teams who want to mount the chat surface inside a SwiftUI hierarchy. It is **not** the canonical entry point — the reference app is pure UIKit and routes from `SceneDelegate` → `FrameworkManager` → `HomeScreenViewController` (a `UITabBarController`). For UIKit projects, prefer the SceneDelegate path above and mount `CometChatConversations()` / `HomeScreenViewController` directly; use this SwiftUI wrapper only when the host app is SwiftUI.
1019
+
1020
+ ```swift
1021
+ // CometChat/CometChatApp.swift — skills-authored SwiftUI convenience wrapper (NOT the canonical app)
1022
+ import SwiftUI
1023
+ import UIKit
1024
+ import CometChatBuilder
1025
+ import CometChatUIKitSwift
1026
+ import CometChatSDK
1027
+
1028
+ /// SwiftUI convenience wrapper around the chat surface (skills-authored, not from the ZIP).
1029
+ /// Master/detail SwiftUI host: `CometChatConversations` at root, `MessagesVC` pushed on tap.
1030
+ /// Feature visibility flags are read from `CometChatBuilderSettings.shared`.
1031
+ public struct CometChatApp: View {
1032
+ public init() {}
1033
+ public var body: some View {
1034
+ ConversationsContainer().ignoresSafeArea()
1035
+ }
1036
+ }
1037
+
1038
+ private struct ConversationsContainer: UIViewControllerRepresentable {
1039
+ func makeUIViewController(context: Context) -> UINavigationController {
1040
+ let conversationsVC = CometChatConversations()
1041
+ let core = CometChatBuilderSettings.shared.chatFeatures.coreMessagingExperience
1042
+ conversationsVC.hideUserStatus = !core.userAndFriendsPresence
1043
+ conversationsVC.hideReceipts = !core.messageDeliveryAndReadReceipts
1044
+
1045
+ let nav = UINavigationController(rootViewController: conversationsVC)
1046
+ conversationsVC.set(onItemClick: { [weak nav] conversation, _ in
1047
+ let vc = MessagesVC()
1048
+ // Qualify with CometChatSDK. — this file imports SwiftUI, which also
1049
+ // exports a `Group` type, so a bare `Group` is "ambiguous for type lookup"
1050
+ // and won't compile. (User is unambiguous but qualified here for parity.)
1051
+ if let user = conversation.conversationWith as? CometChatSDK.User { vc.user = user }
1052
+ else if let group = conversation.conversationWith as? CometChatSDK.Group { vc.group = group }
1053
+ nav?.pushViewController(vc, animated: true)
1054
+ })
1055
+ return nav
1056
+ }
1057
+ func updateUIViewController(_ uiViewController: UINavigationController, context: Context) {}
1058
+ }
1059
+
1060
+ private extension UIColor {
1061
+ convenience init?(hex: String) {
1062
+ let s = hex.replacingOccurrences(of: "#", with: "")
1063
+ guard s.count == 6, let rgb = UInt32(s, radix: 16) else { return nil }
1064
+ self.init(red: CGFloat((rgb >> 16) & 0xFF) / 255,
1065
+ green: CGFloat((rgb >> 8) & 0xFF) / 255,
1066
+ blue: CGFloat(rgb & 0xFF) / 255,
1067
+ alpha: 1)
1068
+ }
1069
+ static func dynamicColor(lightModeColor: UIColor?, darkModeColor: UIColor?) -> UIColor {
1070
+ UIColor { traits in
1071
+ (traits.userInterfaceStyle == .dark ? darkModeColor : lightModeColor) ?? UIColor.label
1072
+ }
1073
+ }
1074
+ }
1075
+ ```
1076
+
1077
+ `MessagesVC.swift` is **copied verbatim** from `CometChatBuilderSwift/BuilderApp/View Controllers/CometChat Components/MessagesVC.swift` (inside the Ios Visual Builder ZIP at https://preview.cometchat.com/downloads/cometchat-builder-ios.zip). It composes header + list + composer in a `UIViewController` and wires reaction / thread / typing per `CometChatBuilderSettings.shared.chatFeatures.*`. Do not hand-roll this — the canonical file is the reference.
1078
+
1079
+ `Secrets.swift` is the credentials enum (`enum Secrets { static let appID = "..."; static let region = "..."; static let authKey = "..." }`) populated by Step 2c provision. Added to `.gitignore`. (Note: this is the convention for integrating into the user's OWN app. The dashboard-exported **reference builder app** instead ships `AppConstants.swift` — a `public class AppConstants` with mutable `APP_ID`/`AUTH_KEY`/`REGION` statics persisted to `UserDefaults` + a `ChangeAppCredentialsVC` for runtime entry; verified 2026-06-14 against a real exported ZIP. If you're editing the exported app directly, set creds in `AppConstants.swift`.)
1080
+
1081
+ **UIKit (canonical) vs SwiftUI hosts.** The reference app is **pure UIKit**: `FrameworkManager.setRootViewController(...)` (called from the init `completion:` above) sets either `UINavigationController(rootViewController: HomeScreenViewController())` or a `SplitViewController` on iPad — see `CometChatBuilderSwift/BuilderApp/SceneDelegate.swift` + `FrameworkManager.swift` + `View Controllers/HomeScreenViewController.swift` (inside the Ios Visual Builder ZIP at https://preview.cometchat.com/downloads/cometchat-builder-ios.zip). The `CometChatApp` SwiftUI wrapper above is the alternative for SwiftUI-hosted apps; it wraps the same `CometChatConversations` surface in a `UIViewControllerRepresentable`.
1082
+
1083
+ ### Calls + builder
1084
+
1085
+ If `CometChatBuilderSettings.shared.callFeatures` has any enabled feature:
1086
+ 1. Init Calls SDK at the same site as UI Kit (see `cometchat-ios-calls`)
1087
+ 2. Mount `CometChatIncomingCall` at app root (SwiftUI App's `WindowGroup` root, or UIKit's `keyWindow.rootViewController` overlay — the builder repo's `BuilderApplication`-equivalent pattern in `SceneDelegate.swift` is the reference)
1088
+ 3. PushKit + CallKit wiring — defer to `cometchat-ios-push`
1089
+
1090
+ ### What is NOT honored in v1
1091
+
1092
+ The builder repo's `HomeScreenViewController` is a `UITabBarController` with up to 4 tabs (Chats / Calls / Users / Groups) driven by `CometChatBuilderSettings.shared.layout.tabs`. Skills' thin wrapper emits a single conversations surface, not the tabbed shape. Theme color + typography + chat-feature toggles ARE honored. To get the tabbed shape, copy `HomeScreenViewController.swift` from the builder repo instead of the wrapper template above.