Latest 1.0.1
Homepage https://github.com/thefuntasty/Gutenberg
License MIT
Platforms ios 8.0, requires ARC
Authors

Version
License
Platform

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")!)

Set default height and offset based on your preferred font so the emojis are aligned nicely (optional)

Gutenberg.setDefaultHeight(self.textLabel.font.lineHeight)
Gutenberg.setDefaultYOffset(self.textLabel.font.descender)

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.

Latest podspec

{
    "name": "Gutenberg",
    "version": "1.0.1",
    "summary": "Tiny library for generating attributed string with emoticons as images",
    "description": "Gutenberg is tiny library that can generate attributed string with images by translating registred codes like *smile* or :-)",
    "homepage": "https://github.com/thefuntasty/Gutenberg",
    "license": "MIT",
    "authors": {
        "Aleu0161 Kocur": "[email protected]"
    },
    "source": {
        "git": "https://github.com/thefuntasty/Gutenberg.git",
        "tag": "1.0.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "Gutenberg": [
            "Pod/Assets/*.png"
        ]
    }
}

Pin It on Pinterest

Share This