Messenger Clone - Real-time iOS Chat with Firebase Firestore written in Swift

Overview

Real time Swift iOS Chat with Firebase - Messenger Clone

This is an extremely simple chat app source code of an iOS Swift Chat app. It leverages MessageKit and it stores and retrieves data to/from Firebase Firestore. The app design is inspired by Facebook Messenger. Clone the iOS Chat App Source Code and add a fully fledged chat to your app in minutes.

Learn how to build your own iOS chat feature with only a few lines of code. Clone this iOS chat app source code and get started by following the steps below. For more details, check out our detailed technical documentation on the official iOS Swift Chat app page.

If you get a build error in latest Xcode, make sure you run Xcode's Legacy Build System (File -> Workspace Settings).


How to run a demo app

  1. Download the source code by cloning this repository
  2. Download the GoogleService-Info.plist file from your Firebase Console and replace the existing file in ChatApp folder. This will connect the app to your own Firebase instance.
  3. Install the pods by running
pod update
  1. Open the xcworkspace file with the latest version of Xcode

How to integrate the chat into your app

  1. Download the source code and import the "Core" folder into your Xcode project
  2. Make sure you add all the Podfile dependencies into your own Podfile
  3. Replace the GoogleService-Info.plist file with your own file, downloaded from Firebase Console.
  4. Install the pods
pod update
  1. Use the following code to instantiate a chat view controller
let uiConfig = ATCChatUIConfiguration(primaryColor: UIColor(hexString: "#0084ff"),
                                      secondaryColor: UIColor(hexString: "#f0f0f0"),
                                      inputTextViewBgColor: UIColor(hexString: "#f4f4f6"),
                                      inputTextViewTextColor: .black,
                                      inputPlaceholderTextColor: UIColor(hexString: "#979797"))
let channel = ATCChatChannel(id: "channel_id", name: "Chat Title")
let viewer = ATCUser(firstName: "Florian", lastName: "Marcu")
let chatVC = ATCChatThreadViewController(user: viewer, channel: channel, uiConfig: uiConfig)

// Present the chatVC view controller
  1. Customize the UI by updating the ChatUIConfiguration class
    let mainThemeBackgroundColor: UIColor = .white
    let mainThemeForegroundColor: UIColor = UIColor(hexString: "#3068CC")
    let mainTextColor: UIColor = UIColor(hexString: "#000000")
    let mainSubtextColor: UIColor = UIColor(hexString: "#7e7e7e")
    let statusBarStyle: UIStatusBarStyle = .default
    let hairlineColor: UIColor = UIColor(hexString: "#d6d6d6")

    let regularSmallFont = UIFont.systemFont(ofSize: 14)
    let regularMediumFont = UIFont.systemFont(ofSize: 17)
    let regularLargeFont = UIFont.systemFont(ofSize: 23)
    let mediumBoldFont = UIFont.boldSystemFont(ofSize: 17)
    let boldLargeFont = UIFont.boldSystemFont(ofSize: 23)
    let boldSmallFont = UIFont.boldSystemFont(ofSize: 14)
    let boldSuperSmallFont = UIFont.boldSystemFont(ofSize: 11)
    let boldSuperLargeFont = UIFont.boldSystemFont(ofSize: 29)

    let italicMediumFont = UIFont.italicSystemFont(ofSize: 17)

Coded with love and supported by iOS App Templates.

This project was created using Cupertino Kit.

Comments
  • I am unable to get the receiver message

    I am unable to get the receiver message

    I have downloaded code and update the pod. Integrated GoogleInfo.plist in the source code. When I run the code, I am able to send the message and message is storing on firebase database, while unable to get message of receiver if receiver reply for my message. Please suggest what am I missing. I am using two different simulator with different sender and receiverID.

    opened by rajan-dev 4
  • Updated for latest Xcode/Swift syntax

    Updated for latest Xcode/Swift syntax

    • Updated project to resolve semantics issues with Xcode 10 and latest version of Swift
    • Removed Google .plist, users will have to provide their own
    • There is one outstanding issue of having to remove the camera button. The .system reference in the base master is no longer possible, would be good to know what the right approach for that is and have it re-implemented.
    opened by DanBurkhardt 2
  • Firestore convenience, camera button added back, pods removed, .gitignore implemented, other stuff

    Firestore convenience, camera button added back, pods removed, .gitignore implemented, other stuff

    added a convenience class that will help new devs get this working with a new instance of Firestore (ATCRemoteData.swift), added .gitignore to prevent accidental commits with GoogleService-Info.plist, gitignore won't track or add pods or Podfile.lock, debugging statements added throughout-- not having them means a clean terminal, but it is damn hard to stack trace if we don't know what is working and how. Also, modified ID scheming, it is more logical to make the chat threads look like {userID}:{userID} instead of concatenating the two

    opened by DanBurkhardt 1
  • I want to display text messages in different ways (e.g.. all CAPS), but what variable is the text stored??

    I want to display text messages in different ways (e.g.. all CAPS), but what variable is the text stored??

    I want to allow the user to display incoming messages in different ways (for example, a user might want to show all incoming chat messages in all CAPS). But I'm confused... in what variable is the text stored?

    I'm looking in the ATCChatMessage.swift file, and I see three variables which seem to store the message's text: (1) content: String, (2) messageText: String, and (3) kind: MessageKind (which I realize is a MessageKit Type). I don't really see a difference between "content" and "messageText". I guess, to simplify my question, where in the swift code is the chat message text displayed, and from what variable is it fetching from? That way I know which variable I can edit if I want the user to make different adjustments on the text based on predefined settings.

    Any help from someone would be greatly appreciated!

    opened by eric-solberg 0
  • Can not send Photos

    Can not send Photos

    When using the ChapAppTemplateSwiftMarch 15 demo app, I can not get photos to show in the Chat room.

    When using the camera, I get the console message as follows: [Camera] Failed to read exposureBiasesByMode dictionary.

    When using the photo library, I do get: [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( "<NSLayoutConstraint:0x2800bbde0 UIView:0x1055e17e0.width == - 16 (active)>" )

    Will attempt to recover by breaking constraint <NSLayoutConstraint:0x2800bbde0 UIView:0x1055e17e0.width == - 16 (active)>

    Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful. 2020-11-08 13:38:52.843059-0800 ChatApp[2194:311708] [View] First responder warning: '<ChatApp.InputTextView: 0x109023800; baseClass = UITextView; frame = (0 0; 297 30); text = ''; clipsToBounds = YES; tintColor = UIExtendedSRGBColorSpace 0.188235 0.407843 0.8 1; gestureRecognizers = <NSArray: 0x282c791a0>; layer = <CALayer: 0x28226f940>; contentOffset: {0, 0}; contentSize: {150, 31.333333333333332}; adjustedContentInset: {0, 0, 0, 0}>' rejected resignFirstResponder when being removed from hierarchy

    Any help is appreciated. Thanks!

    opened by hsmith825 0
  • 237 Warning and 1 Error when using with swift5 and Xcode 11. Any fixes?

    237 Warning and 1 Error when using with swift5 and Xcode 11. Any fixes?

    Can't convert the file to swift 5 because it doesn't build. I'm getting around 237Warnings and 1 Error. (see attached files)

    Does anyone got a newer version already?

    Bildschirmfoto 2020-04-24 um 21 31 13

    Keep the work up! really cool project, and I am really very very sad that I can't actually add it to my social media app :(

    For fo a fix, Kind regards & Stay Safe Constantin

    opened by graphiGuy 3
  • 'MessageInputBarDelegate' has been explicitly marked unavailable here

    'MessageInputBarDelegate' has been explicitly marked unavailable here

    When I build on Xcode I receive:

    'MessageInputBarDelegate' has been renamed to 'InputBarAccessoryViewDelegate'
    

    Upon some research in MessageKit I've found:

    https://github.com/MessageKit/MessageKit/blob/5e16637ffc1fb39f2c3f9bc3396bbee41118947d/Sources/Supporting/MessageInputBar.swift#L31

    https://github.com/MessageKit/MessageKit/blob/413fd8f6ebad43efdde5f98be5fafb2e7986d83b/CHANGELOG.md#dependency-changes

    So I suppose MessageKit should be pegged to a version in the Podfile, but I'm unsure what version it was intended for...

    opened by lonnylot 0
Chat SDK iOS - Open Source Mobile Messenger

Chat SDK Open Source Messaging framework for iOS Chat SDK is a fully featured open source instant messaging framework for iOS. Chat SDK is fully featu

Chat SDK 879 Jan 6, 2023
Phantom Anonymous Messenger for iOS

?? Phantom for iOS This repository contains the complete source code of Phantom for iOS. Table of Contens ?? Report Bugs/Feature Requests/Security Iss

null 2 Mar 14, 2022
A lightweight framework to build chat applications, made in Swift

Chatto Chatto is a Swift lightweight framework to build chat applications. It's been designed to be extensible and performant. Along with Chatto there

Badoo Tech 4.4k Dec 19, 2022
OpenTok Text Chat Accelerator Pack enables text messages between mobile or browser-based devices.

Text Chat Accelerator Pack iOS This project is deprecated The OpenTok Text Chat Accelerator Pack for iOS project is now a part of Accelerator Core iOS

OpenTok 13 Jan 26, 2022
MQTT for iOS and macOS written with Swift

CocoaMQTT MQTT v3.1.1 client library for iOS/macOS/tvOS written with Swift 5 Build Build with Xcode 11.1 / Swift 5.1 Installation CocoaPods Install us

EMQ X MQTT Broker 1.4k Dec 29, 2022
A very flexible message bar for iOS written in Swift.

A very flexible message bar for iOS written in Swift.

SwiftKick Mobile 6.7k Jan 5, 2023
A SlackTextViewController replacement written in Swift for the iPhone X.

Installation Just add MessageViewController to your Podfile and install. Done! pod 'MessageViewController' Setup You must subclass MessageViewControll

GitHawk 1.7k Jan 4, 2023
A fully fledged syscfg editor. Just the editor. Written in pure swift.

MagicCFG Reloaded The SysCFG Writing Utility - UPDATED, OSV Report Bug Table of Contents About MagicCFG Reloaded Getting Started Roadmap Contact Credi

Jan Fabel 47 Dec 31, 2022
Meerkat is a messaging app written using SwiftUI.

Meerkat - A Messaging App Purpose I studied to learn SwiftUI dynamics, understand the syntax, and learn how to integrate third party libraries. The ap

fischerweise 2 Jun 22, 2022
Swift toolkit for passing messages between iOS apps and extensions.

_________ ___ ___ _ _____ _________ ___ ___ / / \ \ / / |_| ( ___ \ \__ __/ \ \ / / / _____/ \ \ /\ /

Abdullah Selek 58 Nov 3, 2022
An XMPP Framework in Objective-C for Mac and iOS

XMPPFramework An XMPP Framework in Objective-C for the Mac and iOS development community. Abstract XMPPFramework provides a core implementation of RFC

Robbie Hanson 5.9k Dec 26, 2022
A smooth, responsive and flexible messages UI library for iOS.

AsyncMessagesViewController A smooth, responsive and flexible messages UI library for iOS apps. Built on top of the awesome Texture (formerly AsyncDis

Huy Nguyen 300 Oct 10, 2022
Swift SDK for Apache Kafka

SwiftKafka A swift implementation of Kafka for producing and consuming from event streams. This works by wrapping the librdkafka C library. Swift vers

Kitura 54 Dec 21, 2022
Messenger Clone - Real-time iOS Chat with Firebase Firestore written in Swift

Real time Swift iOS Chat with Firebase - Messenger Clone This is an extremely simple chat app source code of an iOS Swift Chat app. It leverages Messa

Instamobile 615 Dec 27, 2022
Messenger Clone - Real-time iOS Chat with Firebase Firestore written in Swift

Real time Swift iOS Chat with Firebase - Messenger Clone This is an extremely simple chat app source code of an iOS Swift Chat app. It leverages Messa

Instamobile 621 Jan 6, 2023
A full stack real time messenger clone. Frontend is written in swift, and the backend is written in javascript.

FullStack-Messenger-Project A full stack real time messenger clone. Frontend is written in swift, and the backend is written in javascript. The Fronte

Arkash Vijayakumar 6 Nov 29, 2022
Real time chat app written in Swift 5 using Firebase

Quick Chat for iOS Quick Chat for iOS is a real time chat app written in Swift 5 using Firebase. Quick Chat allows to send and receive text messages,

Henry Aslanyan 1.8k Dec 10, 2022
Flash-Chat - Firebase Cloud Firestore, TableViews and Cocoapod Dependencies

Flash-Chat Firebase Cloud Firestore, TableViews and Cocoapod Dependencies What I

null 0 Jan 19, 2022
Real time chat application in Swift 5 using Firebase

Real time chat application in Swift 5 using Firebase

null 1 May 13, 2022
Create a real time chat application in Swift 5 using Firebase

Messenger Real Time Chat App Project to create a real time chat application in Swift 5 using Firebase. Features Facebook Log In Google Sign In Email/P

null 2 May 29, 2022