How niochat/nio works
Project type and purpose
• This is a full‑stack iOS application (Nio) that implements a Matrix chat client in Swift, using SwiftUI (NioApp.swift, Views, SceneDelegate) and a custom core library (NioKit) for the domain and networking layers. It also provides a share extension (NioShareExtension).
High‑level architecture overview
• UI Layer (SwiftUI Views + ViewModels)
– Uses MVVM: each View has an accompanying ViewModel (e.g., MessageViewModel).
• Domain & Networking Layer (NioKit)
– Configuration: loading API endpoints and client settings.
– Session: AccountStore (keychain), MXClient publishers, authentication flows.
– Models: events, room summaries, custom events (edits, reactions).
– Extensions for convenience (Combine wrappers, URL utilities).
• Data & Storage
– AccountStore persists credentials (Keychain).
– No local database; state lives in memory and is rebuilt from server events.
• External Services
– Matrix homeserver via HTTP REST and WebSocket connections.
– Localization service (translate.riot.im for translations).
• Auxiliary Components
– NioShareExtension: separate target/process to capture URLs from share sheet, communicates with the same domain layer.
– Resources: Assets.xcassets, Localizable.strings for i18n.
– CI/CD: GitHub Workflows for iOS build and SwiftLint, Fastlane for automated releases.
Diagramming conventions
– Blue: UI components
– Green: Domain/SDK
– Yellow: Networking & storage
– Orange: External services
– Purple: Share extension