Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

Commit

Permalink
Updated usage
Browse files Browse the repository at this point in the history
  • Loading branch information
zenkimoto committed Jul 1, 2018
1 parent 4bb08af commit 5a2f433
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Start by importing the Emojione iOS library.

**`import emojione_ios`**

Instantiate the Emojione client.
Instantiate the Emojione client using the default rule set.

**`let client = Client()`**

Expand All @@ -20,9 +20,9 @@ _The default ruleset is recommended._

The following properties are available in the Swift/iOS version of the Emojione library:

- `emojiVersion` (str) - Used only to direct CDN path. This is a 2-digit version (e.g. '3.1'). Not recommended for usage below 3.0.0.
- `emojiVersion` (string) - Used only to direct CDN path. This is a 2-digit version (e.g. '3.1'). Not recommended for usage below 3.0.0.
- `emojiSize` (enum) **Default: `32`** - Used only to direct CDN path for non-sprite PNG usage. Available options are '32', '64', and '128'.
- `imagePathPNG` (str) - Defaults to CDN (jsdelivr) path. Setting as alternate path overwrites `emojiSize` option.
- `imagePathPNG` (string) - Defaults to CDN (jsdelivr) path. Setting as alternate path overwrites `emojiSize` option.
- `greedyMatch` (bool) **Default: `false`** - When `true`, matches non-fully-qualified Unicode values.
- `ascii` (bool) **Default `false`** - When `true`, matches ASCII characters (in `unicodeToImage` and `shortnameToImage` functions).
- `riskyMatchAscii` (bool) **Default `false`** - When `true`, matches ASCII characters not encapsulated by spaces. Can cause issues when matching (e.g. `C://filepath` or `<button>.</button>` both contain ASCII chars).
Expand All @@ -35,27 +35,27 @@ Below there are some examples of how you will actually use the libraries to conv
### Client Functions


**`client.toShort(string) -> String`** - _native unicode -> shortnames_
**`client.toShort(String) -> String`** - _native unicode -> shortnames_

Take native unicode emoji input and translate it to their corresponding shortnames. (we recommend this for database storage)


**`client.shortnameToImage(string, UIFont) -> NSAttributedString`** - _shortname -> images_
**`client.shortnameToImageAsync(string, UIFont, (NSAttributedString) -> Void)`** - _shortname -> images_
**`client.shortnameToImage(String, UIFont) -> NSAttributedString`** - _shortname -> images_
**`client.shortnameToImageAsync(String, UIFont, (NSAttributedString) -> Void)`** - _shortname -> images_

Take input containing only shortnames and translate it directly to EmojiOne images (when displaying the unified input to clients). The UIFont parameter is used to calculate the line height to display the emoji image appropriately. The asynchronous version takes a callback as the third argument.

**`client.shortnameToUnicode(string) -> String`** - _shortname -> native unicode emoji_
**`client.shortnameToUnicode(String) -> String`** - _shortname -> native unicode emoji_

Take input containing only shortnames and translate it directly to Unicode Emoji (when displaying the unified input to clients).

**`client.unicodeToImage(string, UIFont) -> NSAttributedString`** - _native unicode -> images_
**`client.unicodeToImageAsync(string, UIFont, (NSAttributedString) -> Void)`** - _native unicode -> images_
**`client.unicodeToImage(String, UIFont) -> NSAttributedString`** - _native unicode -> images_
**`client.unicodeToImageAsync(String, UIFont, (NSAttributedString) -> Void)`** - _native unicode -> images_

Takes native unicode emoji input and translate it directly to EmojiOne images. The UIFont parameter is used to calculate the line height to display the emoji image appropriately. The asynchronous version takes a callback as the third argument.

**`client.toImage(string, UIFont) -> NSAttributedString`** - _native unicode + shortnames -> images_
**`client.toImageAsync(string, UIFont, (NSAttributedString) -> Void)`** - _native unicode + shortnames -> images_
**`client.toImage(String, UIFont) -> NSAttributedString`** - _native unicode + shortnames -> images_
**`client.toImageAsync(String, UIFont, (NSAttributedString) -> Void)`** - _native unicode + shortnames -> images_

Takes a string containing both native unicode emoji and shortnames, and translate it into EmojiOne images for display. The UIFont parameter is used to calculate the line height to display the emoji image appropriately. The asynchronous version takes a callback as the third argument.

0 comments on commit 5a2f433

Please sign in to comment.