A lightweight real-time chat application built with SwiftUI, Combine, and WebSocket integration using PieSocket.
- Real-time messaging with socket connection (PieSocket)
- Offline message queuing and automatic retry when the network restored
- Dynamic chat list with unread message counts
- Socket reconnects when the app returns from the background
- Timestamps for each message (formatted display)
- Smart sorting: recent active chats float to the top
- Real-time network monitoring using NWPathMonitor
- Clean MVVM structure using Combine for reactive updates
- Dummy users and quick login options for testing
- Swift 5+
- SwiftUI
- Combine
- NWPathMonitor
- PieSocket WebSocket SDK
-
Clone the repository:
git clone https://github.com/isandeepj/RealTimeChatApp-SwiftUI.git cd RealTimeChat
-
Open in Xcode:
open RealTimeChat.xcodeproj
-
Build and Run:
- Select a Simulator or your iOS Device (iOS 17+).
- Press
Cmd + R
.
Note: The app connects to PieSocket's WebSocket server for real-time updates. No server setup needed.
ViewModels/
: ChatViewModel manages sockets and chatsViews/
: SwiftUI screens for login, chat list, chat detailModels/
: User, Chat, Message, Payload structuresNetworking/
: PieSocket WebSocket manager abstraction