Files
simplex-chat/apps/ios/spec
Evgeny @ SimpleX Chat 4eeddce11d core, ui: chatItemUpdated event has the previous item (#8219)
* core, ui: chatItemUpdated event has the previous item

Apps change counters by the difference between the previous and the new item, and insert an updated item only when the update created it.

* core, ui: a recreated item is sent as newChatItems

An update of a locally deleted message creates it again and sends it as a new item, so chatItemUpdated always has the previous item and the apps never insert on an update.

* core, ui: previous item is optional and has no chat info

Events from older remote hosts decode without it; the apps then insert the item if it is not loaded and change no counters.

* core: catch-up subscriber gets an edited history post as a new item

* ui: updates in another profile do not notify, as on iOS

* core, ui: one type for the updated item and its previous version

AChatItemUpdate has the chat info, the new item and the previous item with the same chat type and direction. Its JSON is the JSON of AChatItem with an optional prevChatItem; the event keeps the key chatItem.

* core: tested event key, previous item reactions, cleared mentions

One function renames the event field to chatItem for JSON and docs, and the test checks the wire key and compatibility with AChatItem. The previous item of a direct edit has its reactions. An edit that removes all mentions sends the item without them.

* core: test that an edit removing mentions sends the item without them

* core: event JSON field mapping inline in the TH options, for the Windows build

* core: file chat item update checked in one store transaction

* core: test that a file reset by unknown relays sends its previous item

* core, ui: chatItemUpdated event key chatItemUpdate

* core, ui: chatItemUpdated always has the previous item

* ci: mcp scope tests the plugin with its published dependencies

* core: mention of the user follows edits of a group message

* core: previous item of a prohibited file is read before the prohibition

* android, desktop: missed call check inline, counter test with core pairs

* ios: spec link of the chatItemUpdated event

* core: mention edits in support chats update members requiring attention

* core: one rule for the mention of the user in received and edited items

* core: record item events of updates for app tests

* android, desktop: remove the missed call notification of updates, never shown

* android, desktop: test item updates on events recorded by the core

* ios: test item updates on events recorded by the core

* docs: plan of app tests of item updates, recording tests in the CI guide

* core: record the response to an update after its item status is final

* ios: notification manager replaceable in tests

* ios: test notifications of updates and the update response

* android, desktop: test the recorded update response

* docs: plan with iOS notifications and the update response

* core: recorded response to an update of a sent message
2026-11-17 20:47:18 +00:00
..
2026-02-19 10:58:16 +00:00

SimpleX Chat iOS -- Specification Overview

Technical specification suite for the SimpleX Chat iOS application. Each document provides bidirectional links to product documentation and source code.

Executive Summary

The SimpleX Chat iOS app is a native SwiftUI frontend that communicates with a Haskell core library via C FFI. All chat logic, encryption, protocol handling, and database operations happen in the Haskell core (chat_ctrl). The iOS layer handles UI rendering, system integration (CallKit, Push Notifications, Background Tasks), local preferences, and theming. The app shares its database with a Notification Service Extension (NSE) for decrypting push payloads while the main app is inactive.

Dependency Graph

SimpleXApp (root entry point)
├── ChatModel (ObservableObject state) <-> SimpleXAPI (FFI bridge) <-> Haskell Core (chat_ctrl)
├── Views (SwiftUI)
│   ├── ChatListView -> ChatView -> ComposeView
│   ├── ChatItemView (renders individual messages)
│   ├── Settings, UserProfiles, Onboarding
│   └── ActiveCallView (WebRTC + CallKit)
├── Models
│   ├── ChatModel (global app state -- singleton)
│   ├── ItemsModel (per-chat message list state -- singleton + secondary instances)
│   ├── ChatTagsModel (tag filtering state)
│   └── Chat (per-conversation observable state)
├── Services
│   ├── NtfManager (push notification coordination)
│   ├── BGManager (background task scheduling)
│   ├── CallController (CallKit + VoIP push)
│   └── ThemeManager (theme resolution engine)
└── Extensions
    ├── SimpleX NSE (Notification Service Extension -- decrypts push payloads)
    └── SimpleX SE (Share Extension)

Specification Documents

Document Description
Architecture System architecture, FFI bridge, app lifecycle, extension model
Chat API Reference Complete ChatCommand, ChatResponse, ChatEvent, ChatError type reference
State Management ChatModel, ItemsModel, Chat, ChatInfo, preference storage
Database & Storage SQLite databases, encryption, file storage, export/import
Chat View Message rendering, chat item types, context menu actions
Chat List Conversation list, filtering, search, swipe actions
Message Composition Compose bar, attachments, reply/edit/forward modes, voice recording
Navigation Navigation stack, deep linking, sheet presentation, call overlay
Push Notifications NtfManager, NSE, notification modes, token lifecycle
WebRTC Calling CallController, WebRTCClient, CallKit, signaling via SMP
File Transfer Inline/XFTP transfer, auto-receive, CryptoFile, file constants
Theme Engine ThemeManager, default themes, customization layers, wallpapers
Impact Graph Source file → product concept mapping, risk levels

Source Code Entry Points

File Role
Shared/SimpleXApp.swift App entry point, Haskell init, lifecycle management
Shared/AppDelegate.swift UIApplicationDelegate for push token registration
Shared/ContentView.swift Root view -- authentication gate, call overlay, navigation
Shared/Model/ChatModel.swift Primary observable state (ChatModel, ItemsModel, Chat)
Shared/Model/SimpleXAPI.swift FFI bridge -- chatSendCmd, chatApiSendCmd, sendSimpleXCmd
Shared/Model/AppAPITypes.swift ChatCommand, ChatResponse, ChatEvent enums (iOS app layer)
SimpleXChat/APITypes.swift APIResult, ChatError, ChatCmdProtocol (shared framework)
SimpleXChat/ChatTypes.swift User, ChatInfo, Contact, GroupInfo, ChatItem data types
SimpleXChat/SimpleX.h C header for Haskell FFI functions