Skip to content
A lightweight messenger interface for iOS.
Branch: master
Clone or download
asharma-atx New initial commit. Old commits have been removed to ensure that no s…
…ensitive information is released with the open-sourcing of this project.
Latest commit af2288f Feb 16, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example New initial commit. Old commits have been removed to ensure that no s… Feb 15, 2016
Pod New initial commit. Old commits have been removed to ensure that no s… Feb 15, 2016
_Pods.xcodeproj New initial commit. Old commits have been removed to ensure that no s… Feb 15, 2016
.gitignore New initial commit. Old commits have been removed to ensure that no s… Feb 15, 2016
.travis.yml
ASMessenger.podspec New initial commit. Old commits have been removed to ensure that no s… Feb 15, 2016
CHANGELOG.md New initial commit. Old commits have been removed to ensure that no s… Feb 15, 2016
LICENSE New initial commit. Old commits have been removed to ensure that no s… Feb 15, 2016
README.md New initial commit. Old commits have been removed to ensure that no s… Feb 15, 2016

README.md

ASMessenger [PRE-RELEASE]

IMPORTANT: This is a pre-release. There are known bugs. Features and the API is subject to change.

Version License MIT Platform

[PRE-RELEASE] ASMessenger is a lightweight and performant messenger interface that's easy to implement. It's ideal for customer-support type conversations, such as a discussion between an Uber driver and rider.

alt tag

Demo

View a GIF of the demo app, or try it out yourself by running pod try ASMessenger.

About

ASMessenger was originally created to meet the needs of a specific project. Realizing that the library was versatile enough that others may find it useful, I decided to open source it.

ASMessenger is intended for simple use cases and is kept on a strict diet. I want to keep it as a distinctly lightweight option for when more powerful messaging libraries are an overkill. Consequently, ASMessenger will not support "heavier" features such as inline GIFs, videos, maps, avatar images, or extensive cell customizations.

If you need a more powerful or customizable messaging interface, I highly recommend JSQMessagesViewController.

Features

  • Easy integration
  • Automagical scroll performance optimization
  • Customizable color schemes
  • Group-chat style name labels
  • Selectable and copyable messages
  • Dynamic Type support
  • Data Detection
  • Text input field that tightly follows keyboard through appearing, disappearing, and rotations.
  • Well documented
  • Nifty example app (try it! pod try ASMessenger)

Planned Features

  • More customizations (including fonts!)
  • Automatic time stamping
  • Built in support for asynchronous image loading and caching
  • "Is-Typing" indicator

Planned features are subject to change.

Usage

Install using CocoaPods

pod 'ASMessenger'

Once you've installed ASMessenger, create a subclass of ASMessengerViewController.

Copy and paste the quick-start template below into your subclass's implementation:

// If you're using storyboards, override init to specify what attachment type to use.
// If you're creating the view controller programmatically, this isn't necessary.
- (instancetype)init{

  return [super initWithAttachmentType:ASAttachmentButtonTypePlus];
}

- (void)viewDidLoad{

  [super viewDidLoad];
  [self addInitialEntries];
}

// This is just an example! Replace this with however you would like to add your initial set of entries (if there are any).
- (void)addInitialEntries{

  NSArray * exampleEntryArray = @[[ASEntry messageEntryWithAlignment:ASEntryAlignmentRight name:@"Johnny Appleseed" message:@"Hello!"],
                                  [ASEntry messageEntryWithAlignment:ASEntryAlignmentLeft name:@"Bobby Someone" message:@"Hey, what's up?"],
                                  [ASEntry messageEntryWithAlignment:ASEntryAlignmentRight name:@"Johnny Appleseed" message:@"Not much!"],
                                  [ASEntry attachmentEntryWithAlignment:ASEntryAlignmentLeft name:@"Bobby Someone" title:@"Movie Tickets" subtitle:@"PDF Attachment" attachmentInfo:nil]
                                  ];

  [self setEntriesAndRefresh:exampleEntryArray];
}

#pragma mark - Event Handling Overrides

- (void)sendButtonPressedWithMessage:(NSString *)message{

  // No need to call super, the default implementation does nothing.

  [self clearTextInputView]; // call BEFORE adding a new entry.

  [self addNewEntry:[ASEntry messageEntryWithAlignment:ASEntryAlignmentRight name:@"Johnny Appleseed" message:message]];
}

- (void)attachmentButtonPressed{

  // No need to call super, the default implementation does nothing.

  NSLog(@"attachment button was pressed!");
}

- (void)entrySelected:(ASEntry*)entry{

  // No need to call super, the default implementation does nothing.

  NSLog(@"entry was selected!");
}

Boom, that's it! You're up and running with ASMessenger!

Next Steps:

  • See the ASEntry header to see the different ways you can create ASEntrys.
  • Manage what entries are shown by using the entry management methods built into ASMessengerViewController (see the header).
  • Add custom event handling in the methods under the "Event Handling Overrides" pragma mark.

IMPORTANT: Do not directly set or modify the self.entries array. It will cause unexpected behavior.

Requirements

  • iOS 8.0 +
  • ARC

Credits

ASMessenger is written and maintained by Amit Sharma.

License

ASMessenger is available under the MIT license. See the LICENSE file for more info.

You can’t perform that action at this time.