Build a production-ready iOS real-time chat application using Swift and UIKit for iOS 15 and above. Provide secure registration/login, profile completion, user discovery, one-to-one/group chat, multimedia messaging, presence, typing, message status, notifications, profile management, logout, and account deletion. Use Firebase as the backend platform, including Firebase Authentication, Cloud Firestore, Firebase Realtime Database, Firebase Storage, and Firebase Cloud Messaging. Do not use SwiftUI. Use clean MVVM with separate ViewControllers, ViewModels, models, repositories, Firebase services, and business logic. ViewControllers should remain lightweight and should not contain Firebase business logic. Use protocols and dependency injection where useful, follow Swift best practices, prevent retain cycles, handle async operations correctly, and keep the code testable. On launch, determine authentication and profile state. New users can register with email/password through Firebase Authentication. Existing users can log in/reset passwords; persist authentication sessions. After signup, create a Firestore user document and require profile completion before entering the main application. Complete Profile must require first name, last name, phone number, and photo and cannot be skipped. Store profile information in users/{uid} and set profileCompleted to true. Route incomplete users to Complete Profile, complete users to the app, and others to Login/Signup. The main application must contain exactly three UIKit tabs: Chat, Friends, and Profile. Hide the tab bar during authentication/profile completion. Profile displays first name, last name, email, phone, photo, and About/Status. Users can edit profile information and photo. Store profile photos in Firebase Storage and save the URL/reference in Firestore. Provide Logout and confirmed Delete Account. Delete Account removes the Auth account, users/{uid}, and profile photo. Friends is a global directory without friend requests. Show all users except the current user with photo, name, email, and online/offline status. Support name search. Selecting a user opens an existing chat or creates one. Chat displays one-to-one and group conversations sorted by latest activity, showing name, photo, latest message, timestamp, and unread count. Users can open chats, start chats from Friends, and create groups. One-to-one chat must use Cloud Firestore real-time snapshot listeners. Users can send and receive text, images, audio/voice messages, and videos. Support timestamps, Sent/Delivered/Read status, typing, and real-time updates. Composer supports text, audio recording, camera, and photo/video library. Paginate message history. Enable Firestore offline persistence and sync supported operations after reconnecting. Users can create groups by selecting registered users and providing a group name and optional group photo. The creator becomes Group Admin. Groups support real-time messaging, sender name/avatar, member management, rename, photo change, leaving, and aggregate "seen by" count. Only administrators can perform administrative operations; any member can leave. Support up to 100 members. Support four message types: text, image, audio, and video. Images can be captured using the camera or selected from the photo library, compressed, uploaded to Firebase Storage, referenced from Firestore, displayed as thumbnails, and opened in a full-screen viewer. Audio messages can be recorded in-app, uploaded to Storage, referenced in Firestore, and played with play/pause and progress controls. Videos can be captured or selected, compressed, uploaded to Storage, represented by a Firestore media reference, shown with thumbnails, and played in-app. Media uploads should provide progress and handle failures. Messages must support Reply, Forward, Delete for Me, Delete for Everyone, Copy, and emoji Reactions. Reply retains the original message ID, sender, and suitable content/type information and displays a quoted preview. Forward text, image, audio, and video messages to other one-to-one or group chats. Delete for Me removes a message only from the current user's view. Delete for Everyone allows the sender to remove their own message for all participants within a configurable period, with 24 hours as the default. Display "This message was deleted" after deletion. Allow copying text messages where appropriate. Reactions must be visible to all participants. Group conversations should provide aggregate seen-by information. Use Firebase Realtime Database for typing and presence. Typing can use /typing/{chatId}/{userId}; presence can use /presence/{userId} containing state and lastChanged. Typing should update in near real time without excessive writes and stop when typing ends or the user leaves the chat. Presence should correctly handle connectivity changes and show online/offline information in Friends and relevant areas. Use Cloud Firestore for users, conversations, groups, and messages. The users/{userId} document should contain firstName, lastName, email, phoneNumber, photoURL, status, fcmToken, isOnline, lastSeen, createdAt, and profileCompleted. chats/{chatId} should contain type, participants, groupName, groupPhoto, lastMessage, lastMessageType, lastMessageTimestamp, unreadCount, and admins. Store messages under chats/{chatId}/messages/{messageId}, with senderId, type, content/mediaURL, thumbnailURL, mediaDuration, reply information, forwarding information, reactions, timestamp, status, deletedFor, and isDeletedForEveryone. Use Firestore server timestamps where appropriate and avoid inefficient reads/writes. Use Firebase Storage for profile photos and message media. Organize storage paths using user, chat, and message identifiers. Do not store large binary files in Firestore. Compress media before upload when appropriate and secure Storage access with Firebase Security Rules. Integrate Firebase Cloud Messaging for push notifications. When a new message arrives while the application is backgrounded or killed, show sender name and text preview or a media label such as Photo, Video, or Audio. Tapping a notification should open the relevant conversation. Store and refresh FCM tokens correctly and support APNs configuration for production notifications. Security must be enforced through Firebase Security Rules, not only UI restrictions. Only authenticated users can access protected resources. Users can access only authorized conversations and should not modify other users' profiles. Group administration must be restricted to administrators, and message operations must follow appropriate permissions. Storage access must also be restricted. Never hard-code sensitive credentials. Support Light Mode and Dark Mode, iPhone screen sizes, safe areas, keyboard handling, accessibility, responsive layouts, and Apple's Human Interface Guidelines. The interface should be modern, clean, responsive, and optimized for smooth chat scrolling. Use reusable UIKit components for user cells, chat cells, message cells, avatars, presence indicators, media messages, loading states, empty states, and errors. Required screens include Splash/Onboarding, Login, Signup, Forgot Password, Complete Profile, Main Tab Bar, Chat List, Friends, Profile, Edit Profile, New Chat, Create Group, Chat Screen, Media Viewer, Audio Player, Message Action Sheet, Group Info, and Group Member Management. Develop incrementally. First create the Xcode project foundation, UIKit structure, MVVM architecture, Firebase configuration, folder organization, navigation, theme and common utilities. Then implement authentication and profile completion, followed by Profile, Chat, Friends, and user directory. Next implement one-to-one real-time messaging, pagination, message status, typing, and offline support. Then implement groups and administration, multimedia messaging and Storage, message reply/forward/delete/reactions, FCM notifications, security rules, performance optimization and testing. Before each feature, inspect the project and identify the approach and files to create/modify. Implement only the requested functionality and do not modify unrelated files. Do not migrate UIKit to SwiftUI, change the iOS deployment target, introduce unnecessary dependencies, or change Firebase technology choices without approval. Handle loading, empty, offline, success, and error states. Properly manage Firebase listeners, asynchronous operations, memory, network failures, and permissions. After each stage, summarize modified files and validation. Build and test relevant functionality. If a requirement is ambiguous, identify it rather than inventing behavior. The final application must be secure, scalable, maintainable, performant, and provide a complete real-time messaging experience using Swift, UIKit, and Firebase.
Sign in to leave a comment
No tasks generated yet.
Tasks will appear here as requirements are defined.

Welcome back. Sign in to pick up your conversations.

Welcome back. Sign in to pick up your conversations.
No comments yet. Be the first!