apple-text-line-breaking

Apply NSParagraphStyle properties for line wrapping, hyphenation, truncation, and spacing in iOS and macOS text rendering.

Updated Mar 19, 2026
One-click install
npx skills add https://github.com/sitapix/apple-text --skill apple-text-line-breaking
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: apple-text-line-breaking
Source: https://github.com/sitapix/apple-text/tree/main/skills/apple-text-line-breaking
Command: npx skills add https://github.com/sitapix/apple-text --skill apple-text-line-breaking

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Use NSParagraphStyle to precisely control how text wraps, truncates, and spaces vertically, ensuring predictable layouts across views.

Core Features & Use Cases

  • Configure lineBreakMode to choose wrapping behavior (word, char, or truncation).
  • Tune lineBreakStrategy and hyphenationFactor for balanced, readable text across languages.
  • Synchronize line height, line spacing, and paragraph spacing for consistent typography in complex layouts.

Quick Start

Configure an NSParagraphStyle with your desired lineBreakMode, lineBreakStrategy, hyphenationFactor, and related properties to observe the effect.

Frequently Asked Questions about apple-text-line-breaking

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I control line wrapping and truncation in NSParagraphStyle for iOS labels?

Line wrapping and truncation in NSParagraphStyle are controlled by setting the lineBreakMode property, which determines whether text wraps by word or character, or truncates with ellipses. You configure this within an attributed string applied to a label or text view.

What's the best way to balance text layout and avoid uneven line breaks in macOS text views?

To balance text layout and avoid uneven line breaks in macOS text views, tune the lineBreakStrategy and hyphenationFactor properties of NSParagraphStyle. These settings optimize whitespace distribution and enable automatic hyphenation for more readable, consistent paragraph rendering.

Why does my attributed string have inconsistent vertical spacing between lines?

Inconsistent vertical spacing in an attributed string usually occurs when NSParagraphStyle properties like minimumLineHeight, maximumLineHeight, lineHeightMultiple, and lineSpacing are not set coherently. Synchronizing these values ensures consistent typography and predictable vertical layout across your UI components.

Can I apply paragraph spacing and custom line heights to attributed strings across both iOS and macOS?

Yes, you can apply paragraph spacing and custom line heights to attributed strings across both iOS and macOS. By configuring NSParagraphStyle with lineHeightMultiple and paragraphSpacing, you achieve consistent typography and predictable text rendering layouts throughout your UI components.

When do I need to set hyphenationFactor and lineBreakStrategy for text rendering?

You need to set hyphenationFactor and lineBreakStrategy when rendering multi-language text that requires balanced, readable layouts. Configuring these NSParagraphStyle properties prevents awkward word wrapping and optimizes the visual flow of text within constrained UI components.

Does configuring NSParagraphStyle properties work with all UIKit and AppKit text components?

NSParagraphStyle properties work with any UIKit or AppKit component that renders attributed strings, including labels and text views. Applying these properties coherently ensures consistent line wrapping, truncation, and spacing behavior across your entire iOS and macOS user interface.