MessengerKit is a drop-in UI for messenger interfaces on iOS built in Swift

Last update: May 15, 2022

MessengerKit for iOS

License: MIT


About

MessengerKit is a drop-in UI for messenger interfaces on iOS built in Swift. Centred around a single UIViewController, MessengerKit is themeable to fit your needs and includes a number of powerful features:

  • UICollectionView based with pre-loading and caching of size calculation for bubbles.
  • Auto-growing input view.
  • Multiple included cell types: text, large-emoji, image, video.
  • Presentation of SFSafariViewController
  • Built-in, customisable themes.
  • A custom theming system to bring your own UICollectionViewCells, headers, footers, and input views.
  • Avatar support (currently only in the travamigos theme).

The framework was built for and is used in production at Travamigos.

Screenshots

MessengerKit Examples

Documentation

Installation

MessengerKit requires Swift 4.2 and iOS 10.0 or later.

Manual

Drag the contents of the MessengerKit folder into your Xcode Project.

CocoaPods

Add the following to your project's Podfile.

pod 'MessengerKit', :git => 'https://github.com/steve228uk/MessengerKit.git'

Credits

MessengerKit was written by @steve228uk for Travamigos and is available under the MIT license.

It makes use of KeyboardUtility by @JunyuKuang.

GitHub

https://github.com/steve228uk/MessengerKit
Comments
  • 1. Custom Message Formats

    Hi @steve228uk,

    Amazing framework! A small question from someone new to iOS dev. I wanted to use MSGMessageBody with custom content (neither text, emoji, image, nor video) but am unsure as to what should be modified to implement this. For instance, I want to have a message bubble with a clickable UIButton inside it. Do you think you could help point me towards what/where I should modify to add such custom message formats?

    Reviewed by svm1 at 2018-07-02 20:08
  • 2. Could not load the "Arrow" image

    Hi there, awesome framework! Quick question :

    After run pod install, implement MSGMessengerViewController, then somehow I got this error :

    Could not load the "Arrow" image referenced from a nib in the bundle with identifier "org.cocoapods.MessengerKit"

    What did I missed ?

    MessengerKit v 1.0.0

    screen shot 2018-07-03 at 12 31 01 pm

    It did work if I change the MSGMessengerStyle to .travamigos style.

    But the arrow is still missing...

    screen shot 2018-07-03 at 12 58 38 pm

    Reviewed by gersonjanhuel at 2018-07-03 05:26
  • 3. NSFetchedResultsController and sections

    Hi @steve228uk,

    First of all thanks for this super easy to use library!

    I am using it with a NSFetchedResultsController, and I am struggling myself trying to get by free the messages grouped by username after ordered by timestamp, but I am not succeeding.

    If I provide the date as sort descriptor, and the user as sectionNameKeyPath, it groups the messages by user, so I get numberOfUsers sections, and ordered by timeStamp inside, but that's not what I want; I want by date, but grouped by user just if the messages are in a sequence, like your example.

    I guess you (or someone) has faced this problem before, I hope haha.

    Thanks in advance

    Reviewed by machukas at 2018-08-31 15:12
  • 4. Blank text is shown after send some text

    On the first time, when the MSGMessengerViewController loads, blank text is shown when send some text. And the text which are send once scrolled, the order of the messages gets misplaced.

    screenshot 2019-01-02 at 10 58 12 am

    Reviewed by V1992 at 2019-01-02 05:41
  • 5. Could not set text to message input view

    Hi, first things first thank you for this great library and hours that you saved for me. in my case i needed to add custom inputView for adding additional features like attach and stickers but now i have a problem. in my app users can edit their messages but because of internal protection level of text property of MSGPlaceholderTextView i can't set text so user can edit it. any ideas for accomplishing this?

    Reviewed by mkhakpaki at 2018-10-22 15:28
  • 6. Fix link style & Add underline option

    The link style option for incoming & outgoing messages were not correct. Only the outgoing option was used. I fixed that in this PR.

    Additional I added a style option for control the underline setting for links.

    Reviewed by Fabi755 at 2020-02-24 19:56
  • 7. MSGMessengerViewController unregisters host app observers from NotificationCenter

    Version: 1.0.4 Reproduction rate: always Description: Currently a VC that derives from MSGMessengerViewController.swift is hidden the default behaviour is to remove the VC from the NotificationCenter. However this affects ALL observers in the derived VC, not just those registered by MessengerKit.

    Case in point, my app needs to keep a notification with NotificationCenter that happens as soon as the app comes to the foreground (via deep link). Because MSGMessengerViewController unregisters on going to the background this behaviour is broken. Now I need to re-register with NotificationCenter after calling super in viewDidDisappear to keep the correct behaviour in place.

    MSGMessengerViewController should only unregister from notifications that it has registered for before instead of unregistering all: NotificationCenter.default.removeObserver(self, name: UIKeyboardWillShow, object: nil)

    Reviewed by parrotbait at 2019-05-20 16:02
  • 8. iOS 9 Support

    Hello guys, this is such a wonderful library! I was wondering, why is iOS 9 not supported? I've forked the project and easily lowered deployment target to 9.0, after adding some

    @available(iOS 9.0, *)
    

    checks, library runs pretty smooth in iOS 9. I can make a pull request if someone wants this too.

    Let me know, thanks :)

    Reviewed by alessioarsuffi at 2019-03-03 11:20
  • 9. Custom Input view is jumping upwards automatically without typing

    If I start typing on custom inputview textfield and go back to any previous screen. After that when I reopened MSGMessengerViewController screen for infinite times automatically the input view will jump up always. I want to prevent this and instead of that the custom input view should only jumps up when start typing something on it. I dont find any solution for this. Pls help.

    skype_picture

    Reviewed by V1992 at 2019-01-31 11:13
  • 10. when push/present subclass ViewController of MSGMessengerViewController

    got error from storyboard

    let vc = CalmConstants.globalConstants.StoryBoard.instantiateViewController(withIdentifier: "ReadingVC") as! ReadingVC
     self.present(vc, animated: true, completion: nil)
    

    where ReadingVC is subclass of MSGMessengerViewController

    • Assertion failure in -[UIStoryboard instantiateViewControllerWithIdentifier:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore/UIKit-3698.84.15/UIStoryboard.m:171
    Reviewed by nitinumaretiya123 at 2018-11-20 11:57
  • 11. Error when calling insert()

    When I call self.insert in my MSGMessengerViewController I get the error Thread 1: EXC_BAD_ACCESS (code=1, address=0xfffffffffffffff8) on the line self.collectionView.performBatchUpdates({ in the MSGMessengerViewController + Helpers.swift file. If there's anymore information I should give, please let me know. :D

    Reviewed by astrike30 at 2018-06-30 23:24
  • 12. How can I add Caption for Image type

    Creating an interesting way to take a note by using MessangerKit. I absolutely love the MessangerKit. https://apps.apple.com/us/app/nanonote-note-to-self/id1575376162#?platform=iphone

    I want to add a caption in the image, same as whatsapp. I am stuck at this stage for the last couple of hours. Any help will be really appreciated. Simulator Screen Shot - iPhone 12 - 2021-07-25 at 15 19 49

    @steve228uk I really like to thank you, You save a lot of time mine by creating this project.

    Reviewed by santudey at 2021-07-25 09:58
  • 13. UI error after camera captured.

    I am trying to send an image from the camera. so I opened chat vc and entered camera caputure screen using UIImagePickerController. Inputview went up to the top and the UI was messed up. This problem has only happened after the first loading.

    IMG_5061 (1)

    How can I avoid this problem?

    Reviewed by lucasanh at 2021-01-18 14:59
  • 14. Add Swift Package Manager support

    Hi,

    This PR contains the following changes to add SPM support:

    • Add the package manifest
    • Add an objc name to custom views to load correctly in SPM (See this forum for details)

    Close #53

    Reviewed by woxtu at 2020-12-02 15:09
  • 15. Override delegate method for collectionView

    When I override the delegate method func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? for collectionView, I get error

    Method does not override any method from its superclass

    How can I call the context menu for collection?

    Reviewed by emelyanovkirill at 2020-10-06 06:54
  • 16. Initialize the image in nil so no flicker from the previous image

    When images were added to the conversations, before downloading, the previous image was shown moments previous to the finished download. Initializing the image in nil before loading the new image fixes the flicker issue.

    Reviewed by jgalindosl at 2020-09-22 02:59
  • 17. Remove input text view

    Is there away to remove the input text view? I tried doing: style.inputView = TrivialInputView.self

    And defining a TrivialnputView by modifying what is found here: https://github.com/steve228uk/MessengerKit/blob/05168377536ebeae3653edfa5acc6410895cd72f/MessengerKit/Input/Styles/iMessage/MSGImessageInputView.swift.

    But it crashes outright with error: Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value for tint color. Even though it is specified.

    Reviewed by lingxiao at 2020-08-23 00:00
Related tags
iOS - Real-time messaging app 🎨
iOS - Real-time messaging app  🎨

General mChat is a real-time messaging app written in Swift for iOS devices. Since mChat uses a fast and reliable Firebase Database, it receives data

May 10, 2022
Chatto is a Swift lightweight framework to build chat applications.
Chatto is a Swift lightweight framework to build chat applications.

Chatto is a Swift lightweight framework to build chat applications. It's been designed to be extensible and performant. Along with Chatto there is ChattoAdditions, a companion framework which includes cells for messages and an extensible input component. You can find more details about how it was implemented in our blog. See them in action!

May 16, 2022
Messenger Clone - Real-time iOS Chat with Firebase Firestore written in Swift
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

May 9, 2022
Messenger Clone - Real-time iOS Chat with Firebase Firestore written in Swift
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

May 9, 2022
Messenger Clone - Real-time iOS Chat with Firebase Firestore written in Swift
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

May 22, 2022
Swift tool to generate Module Interfaces for Swift projects.

ModuleInterface Swift tool to generate Module Interfaces for Swift projects. What is a Module Interface A Module Interface is what we commonly get usi

May 11, 2022
Non-intrusive iOS UI library to implement overlay based interfaces
Non-intrusive iOS UI library to implement overlay based interfaces

OverlayContainer is a UI library written in Swift. It makes easier to develop overlay based interfaces, such as the one presented in the Apple Maps, S

May 17, 2022
Full configurable spreadsheet view user interfaces for iOS applications. With this framework, you can easily create complex layouts like schedule, gantt chart or timetable as if you are using Excel.
Full configurable spreadsheet view user interfaces for iOS applications. With this framework, you can easily create complex layouts like schedule, gantt chart or timetable as if you are using Excel.

kishikawakatsumi/SpreadsheetView has moved! It is being actively maintained at bannzai/SpreadsheetView. This fork was created when the project was mov

May 9, 2022
🌟🌟🌟🌟🌟 Falcon Messenger is a Fast and Beautiful cloud-based messaging app. With iOS and IPadOS Support. Available on the App Store.
🌟🌟🌟🌟🌟 Falcon Messenger is a Fast and Beautiful cloud-based messaging app. With iOS and IPadOS Support. Available on the App Store.

Open the FalconMessenger.xcworkspace in Xcode. Change the Bundle Identifier to match your domain. Go to Firebase and create new project. Select "Add F

May 14, 2022
Open source, native iOS Messenger, with realtime chat conversations (full offline support).
Open source, native iOS Messenger, with realtime chat conversations (full offline support).

OVERVIEW This is a native iOS Messenger app, with realtime chat conversations (full offline support). NEW FEATURES Passcode support GraphQL server sup

May 16, 2022
A private messenger for iOS.

Signal iOS Signal is a free, open source, messaging app for simple private communication with friends. Also available on Android and Desktop. Question

May 14, 2022
Open source, native iOS Messenger, with realtime chat conversations (full offline support).
Open source, native iOS Messenger, with realtime chat conversations (full offline support).

OVERVIEW This is a native iOS Messenger app, with realtime chat conversations (full offline support). NEW FEATURES Passcode support GraphQL server sup

May 14, 2022
Chat SDK iOS - Open Source Mobile Messenger
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

May 22, 2022
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

Mar 14, 2022
Full configurable spreadsheet view user interfaces for iOS applications. With this framework, you can easily create complex layouts like schedule, gantt chart or timetable as if you are using Excel.
Full configurable spreadsheet view user interfaces for iOS applications. With this framework, you can easily create complex layouts like schedule, gantt chart or timetable as if you are using Excel.

kishikawakatsumi/SpreadsheetView has moved! It is being actively maintained at bannzai/SpreadsheetView. This fork was created when the project was mov

May 19, 2022
Compose beautiful command line interfaces in Swift
Compose beautiful command line interfaces in Swift

Commander is a small Swift framework allowing you to craft beautiful command line interfaces in a composable way. Usage Simple Hello World i

May 11, 2022
CommandLineKit - A pure Swift library for creating command-line interfaces

CommandLineKit A pure Swift library for creating command-line interfaces. Note: This project is no longer maintained. It's preserved here for historic

May 15, 2022
You can dismiss modal viewcontroller like Facebook Messenger by pulling scrollview or navigationbar in Swift.
You can dismiss modal viewcontroller like Facebook Messenger by pulling scrollview or navigationbar in Swift.

PullToDismiss PullToDismiss provides dismiss modal viewcontroller function like Facebook Messenger by pulling scrollview or navigationbar with smooth

May 11, 2022
Simple & Elegant Command Line Interfaces in Swift
Simple & Elegant Command Line Interfaces in Swift

An elegant pure Swift library for building command line applications. Features Tons of class, but no classes. 100% organic pure value types. Auto gene

May 14, 2022