apple-text-attachments-ref

Document NSTextAttachment and view provider behavior in Apple Text views.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Use this skill to understand how to embed non-text content inline in Apple Text views, including NSTextAttachment, view providers, and adaptive glyphs, while handling bounds, baseline alignment, and cross-version compatibility.

Core Features & Use Cases

  • Inline image attachments using NSTextAttachment with proper bounds and baseline alignment.
  • Interactive inline content via NSTextAttachmentViewProvider, lifecycle management, and compatibility notes.
  • Genmoji-like inline content with NSAdaptiveImageGlyph and its usage in TextKit 2.
  • Accessibility and cross-platform considerations across iOS and macOS.

Quick Start

Ask a question about embedding non-text content inline in Apple Text views to get practical guidance and examples.

Frequently Asked Questions about apple-text-attachments-ref

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

FAQPage Schema
How do I embed images in an attributed string using NSTextAttachment?

To embed images in an attributed string, use NSTextAttachment to handle inline non-text content within Apple Text views. You must properly configure bounds and baseline alignment to ensure the image renders correctly alongside surrounding text.

Can I add interactive custom views inline in TextKit 2?

Yes, you can add interactive custom views inline in TextKit 2 using NSTextAttachmentViewProvider. This approach allows you to manage the lifecycle of custom UI elements embedded directly within your attributed strings.

What is NSAdaptiveImageGlyph and how does it work with Genmoji?

NSAdaptiveImageGlyph is the mechanism for integrating Genmoji-like inline content within TextKit 2. It defines adaptive image glyphs that render seamlessly as non-text content inside attributed strings on iOS and macOS.

How do I ensure NSTextAttachment bounds and baseline alignment work across iOS and macOS?

To ensure NSTextAttachment bounds and baseline alignment work across iOS and macOS, you must apply cross-version compatibility practices using NSTextAttachmentLayout. This handles layout geometry and accessibility considerations consistently.

Does NSTextAttachmentViewProvider support cross-version compatibility between TextKit 1 and 2?

Yes, NSTextAttachmentViewProvider supports cross-version compatibility between TextKit 1 and 2, but requires specific compatibility notes management. You need to account for lifecycle differences and accessibility requirements across both frameworks.

What are the limitations of using NSTextAttachment for inline content?

Limitations of using NSTextAttachment for inline content include managing complex baseline alignment, handling lifecycle requirements for interactive views, and addressing cross-version compatibility issues between TextKit 1 and 2 on iOS and macOS.