Gutenberg 1.0.1

Gutenberg 1.0.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Dec 2015
SPMSupports SPM

Maintained by Ales Kocur.



Gutenberg 1.0.1

  • By
  • Aleš Kocur

Gutenberg is tiny library that can generate NSAttributedString from given string and replace registered characters with images (emoji).

Usage

Import Gutenberg

import Gutenberg

Create as many emoji as you want

let emoji1 = Emoji(code: "*angry*", image: UIImage(named: "angry")!)
let emoji2 = Emoji(code: "*grin*", image: UIImage(named: "grin")!)

And register them

Gutenberg.registerEmoji(emoji1, emoji2)

Then create label

@IBOutlet weak var textLabel: GutenbergLabel!

and set the text

self.textLabel.text = "Hey! *grin* Where are you? *angry*"

And that's all. If you don't want to use our GuttenbergLabel (it's just UILabel subclass), there is also an extension for UILabel with method gtb_text:.

self.textLabel.gtb_text = "Hey! *grin* Where are you? *angry*"

It's just cosmetics :-)

Requirements

There are no special requirements. Gutenberg takes advantage of the NSTextAttachment class to replace the occurences of registered strings with them.

Installation

Gutenberg is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "Gutenberg"

Author

Aleš Kocur, [email protected]

License

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