apple-text-find-replace

Implement find and replace with UIFindInteraction and NSTextFinder on Apple platforms.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provide practical guidance for adding robust find and replace to Apple platform text editors, including UIFindInteraction, NSTextFinder, and efficient replace-all.

Core Features & Use Cases

  • UIFindInteraction integration for iOS text views and custom editors, enabling a native find UI and search flow.
  • NSTextFinder support on macOS to deliver a native find bar experience within editors.
  • Highlighting strategies for search results using temporary attributes or rendering attributes, plus safe, backward-ordered replace-all to preserve text offsets.
  • Real-world use: implement find and replace in a custom editor, perform per-match highlighting, and execute batch replacements without corrupting ranges.

Quick Start

Describe how to implement find and replace in a simple Apple text editor, wiring UIFindInteraction for iOS and NSTextFinder for macOS, and integrate backward-ordered replace-all.

Frequently Asked Questions about apple-text-find-replace

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

FAQPage Schema
How do I implement find and replace in a custom iOS text editor using UIFindInteraction?

To implement find and replace in a custom iOS text editor, you integrate UIFindInteraction to enable the native find UI and search flow within your text views. This provides standard search functionality without building custom interfaces.

What is the best way to add a native find bar experience to a macOS text editor?

The best way to add a native find bar to a macOS text editor is by implementing NSTextFinder support. This delivers the standard macOS find bar experience directly within your custom editor or text view components.

How does backward-ordered replace-all preserve text ranges during batch replacements?

Backward-ordered replace-all preserves text ranges by executing batch replacements from the end of the document backwards. This prevents earlier replacements from shifting the offsets of subsequent matches, avoiding range corruption.

How do you highlight search results in Apple text views without affecting existing text attributes?

You highlight search results in Apple text views by applying temporary attributes or rendering attributes. This strategy visually marks per-match results without permanently altering the underlying text data or formatting.

Can I use NSTextFinder and UIFindInteraction together across iOS and macOS platforms?

Yes, you can support both platforms by wiring UIFindInteraction for iOS text views and NSTextFinder for macOS within your custom editor. This approach provides native search interactions tailored to each operating system.