Latest 1.0
Homepage https://github.com/Edig/EDChat
License MIT
Platforms ios 9.0
Authors

Simple UI Chat Farmework – SWIFT

Note: This is only a UIChat, does not include any server for it

Installation

pod "EDChat"

Usage

First Step

Import the framework

import EDChat
Second Step

Subclass your UIViewController with EDChatViewController

Now you can run your view and it should work as a chat

EDMessage

Object of EDMessage

var message: String!
var type: EDChatMessageType!
var isOutgoingMessage: Bool = false

Configuration

All posible configuration and their default values

// MARK: - Config Options
var defaultFont: UIFont = UIFont.systemFontOfSize(UIFont.systemFontSize())
var canSendEmptyMessages: Bool = false

//TextBar
var textBarBackground = UIColor.grayColor()
var textBarHeight:CGFloat = 50

//TextField
var textFieldPlaceholder = "Send Message"
var textFieldBackground = UIColor.whiteColor()
var textFieldCornerRadius:CGFloat = 5
var textFieldLeftMargin: CGFloat = 8
var textFieldTextFont = UIFont.systemFontOfSize(UIFont.systemFontSize())

//SendButton
var sendButtonText = "Send"
var sendButtonTextColor = UIColor.whiteColor()
var sendButtonTextFont = UIFont.systemFontOfSize(UIFont.systemFontSize())
var sendButtonDisabledTextColor = UIColor.lightGrayColor()

Insert Messages

To insert a message you need to create an object called EDChatMessage and calling.

If you want to load the screen with messages, call insertMessage on viewDidLoad

Inserting new messages

self.insertMessage(message: EDChatMessage, andScrollToPosition scroll: Bool)

Insert previous messages

final func insertPreviousMessage(message: EDChatMessage)

Customize Bubble

Beside EDChat has a default message view you can create your own view. EDChat will care about the size of the view with constraints, you only need to create your own internal constraints.

In any way you need to override this function

override func viewFromMessage(message: EDChatMessage) -> UIView

Default Bubble

To customize the default bubble you need to create an object EDChatView and this will care about the text based on the message you create

func viewFromMessage(message: EDChatMessage) -> UIView {
    return EDChatMessageView(message: message, withFont: self.defaultFont)
}

Posible configurations

var sendingMessageBackrgound = UIColor.blueColor()
var incomingMessageBackrgound = UIColor.grayColor()
var sendingMessageTextColor = UIColor.whiteColor()
var incomingMessageTextColor = UIColor.whiteColor()

New Bubble

You can create your own UIView by returning it on the overrided function

Override Methods
func messageWillSend(message: EDChatMessage) 
func messageDidSend(message: EDChatMessage)
func viewFromMessage(message: EDChatMessage) -> UIView

Latest podspec

{
    "name": "EDChat",
    "version": "1.0",
    "summary": "Simple UI Chat - SWIFT.",
    "description": "Simpe UI Chat Framework. You can customize colors. Easy message bubbles and fully customizable, with auto-layout.",
    "homepage": "https://github.com/Edig/EDChat",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Eduardo Iglesias": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/Edig/EDChat.git",
        "tag": "1.0"
    },
    "source_files": "EdChat/*.{swift}"
}

Pin It on Pinterest

Share This