gitmyhub

YYText

Objective-C ★ 8.9k updated 1y ago

Powerful text framework for iOS to display and edit rich text.

YYText is an iOS Objective-C library that replaces Apple's UILabel and UITextView with richer text rendering, supporting per-word styling, inline images, tappable links, vertical text, and async rendering to keep the UI smooth.

Objective-CiOSUIKitsetup: easycomplexity 2/5

YYText is an Objective-C library for iOS that gives developers much more control over how text is displayed and edited than the built-in Apple options allow. It works as a drop-in replacement for UILabel (for displaying text) and UITextView (for editing text), so you can switch to it without rewriting your app's existing code structure.

The main reason to use it is rich text: text where different words or characters can have different fonts, sizes, colors, borders, shadows, backgrounds, and other visual effects applied to specific ranges. iOS's built-in text views support some of this, but YYText extends it further with things like inner shadows, block-level borders, background borders, glyph transforms (tilting individual characters), and animated attachments.

Text attachments let you embed images, regular UIView objects, or CALayer objects directly inside a line of text. The library also supports custom tap or long-press highlight ranges, so you can make specific words tappable and style them differently when pressed, which is useful for things like links or hashtags. Built-in parsers handle basic Markdown formatting and emoticon substitution.

For languages like Chinese, Japanese, and Korean that can be written vertically, YYText includes vertical layout support. The library also allows text to flow around shapes using container and exclusion paths, similar to how text wraps around an image in a magazine layout.

Rendering happens asynchronously to avoid blocking the main thread, which matters when displaying long documents or many labeled items at once. Copy and paste of attributed text, undo and redo in the editor, VoiceOver accessibility, and Interface Builder support are all included. The full README is longer than what was shown.

Where it fits