SwiftUI search is environment-based and navigation-consumed. You attach .searchable() to a view, but a navigation container (NavigationStack, NavigationSplitView, or TabView) renders the actual search field. This indirection is the source of most search bugs.
Works with
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionaxiom-swiftui-search-refExecute the skills CLI command in your project's root directory to begin installation:
Fetches axiom-swiftui-search-ref from charleswiltgen/axiom and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate axiom-swiftui-search-ref. Access via /axiom-swiftui-search-ref in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
0
total installs
0
this week
767
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
767
stars
SwiftUI search is environment-based and navigation-consumed. You attach .searchable() to a view, but a navigation container (NavigationStack, NavigationSplitView, or TabView) renders the actual search field. This indirection is the source of most search bugs.
| iOS | Key Additions |
|---|---|
| 15 | .searchable(text:), isSearching, dismissSearch, suggestions, .searchCompletion(), onSubmit(of: .search) |
| 16 | Search scopes (.searchScopes), search tokens (.searchable(text:tokens:)), SearchScopeActivation |
| 16.4 | Search scope activation parameter (.onTextEntry, .onSearchPresentation) |
| 17 | isPresented parameter, suggestedTokens parameter |
| 17.1 | .searchPresentationToolbarBehavior(.avoidHidingContent) |
| 18 | .searchFocused($isFocused) for programmatic focus control |
| 26 | Bottom-aligned search, .searchToolbarBehavior(.minimize), Tab(role: .search), DefaultToolbarItem(kind: .search) — see axiom-swiftui-26-ref |
For iOS 26 search features (bottom-aligned, minimized toolbar, search tab role), see axiom-swiftui-26-ref.
.searchable(
text: Binding<String>,
placement: SearchFieldPlacement = .automatic,
prompt: LocalizedStringKey
)
Availability: iOS 15+, macOS 12+, tvOS 15+, watchOS 8+
.searchable(text: $query) to a viewisSearching and dismissSearch through the environmentstruct RecipeListView: View {
@State private var searchText = ""
let recipes: [Recipe]
var body: some View {
NavigationStack {
List(filteredRecipes) { recipe in
NavigationLink(recipe.name, value: recipe)
}
.navigationTitle("Recipes")
.searchable(text: $searchText, prompt: "Find a recipe")
}
}
var filteredRecipes: [Recipe] {
if searchText.isEmpty { return recipes }
return recipes.filter { $0.name.localizedCaseInsensitiveContains(searchText) }
}
}
| Placement | Behavior |
|---|---|
.automatic |
System decides (recommended) |
.navigationBarDrawer |
Below navigation bar title (iOS) |
.navigationBarDrawer(displayMode: .always) |
Always visible, not hidden on scroll |
.sidebar |
In the sidebar column (NavigationSplitView) |
.toolbar |
In the toolbar area |
.toolbarPrincipal |
In toolbar's principal section |
Gotcha: SwiftUI may ignore your placement preference if the view hierarchy doesn't support it. Always test on the target platform.
Where you attach .searchable determines which column displays the search field:
NavigationSplitView {
SidebarView()
.searchable(text: $query) // Search in sidebar
} detail: {
DetailView()
}
// vs.
NavigationSplitView {
SidebarView()
} detail: {
DetailView()
.searchable(text: $query) // Search in detail
}
// vs.
NavigationSplitView {
SidebarView()
} detail: {
DetailView()
}
.searchable(text: $query) // System decides column
@Environment(\.isSearching) private var isSearching
Availability: iOS 15+
Becomes true when the user activates search (taps the field), false when they cancel or you call dismissSearch.
Critical rule: isSearching must be read from a child of the view that has .searchable. SwiftUI sets the value in the searchable view's environment and does not propagate it upward.
// Pattern: Overlay search results when searching
struct WeatherCityList: View {
@State private var searchText = ""
var body: some View {
NavigationStack {
// SearchResultsOverlay reads isSearching
SearchResultsOverlay(searchText: searchText) {
List(favoriteCities) { city in
CityRow(city: city)
}
}
.searchable(text: $searchText)
.navigationTitle("Weather")
}
}
}
struct SearchResultsOverlay<Content: View>: View {
let searchText: String
@ViewBuilder let content: Content
@Environment(\.isSearching) private var isSearching
var body: some View {
if isSearching {
// Show search results
SearchResults(query: searchText)
} else {
content
}
}
}
@Environment(\.dismissSearch) private var dismissSearch
Availability: iOS 15+
Calling dismissSearch() clears the search text, removes focus, and sets isSearching to false. Must be called from inside the searchable view hierarchy.
struct SearchResults: View {
@Environment(\.dismissSearch) private var dismissSearch
var body: some View {
List(results) { result in
Button(result.name) {
selectResult(result)
dismissSearch() // Close search after selection
}
}
}
}
Pass a suggestions closure to .searchable:
.searchable(text: $searchText) {
ForEach(suggestedResults) { suggestion in
Text(suggestion.name)
.searchCompletion(suggestion.name)
}
}
Availability: iOS 15+
Suggestions appear in a list below the search field when the user is typing.
.searchCompletion(_:) binds a suggestion to a completion value. When the user taps the suggestion, the search text is replaced with the completion value.
.searchable(text: $searchText) {
ForEach(matchingColors) { color in
HStack {
<Prerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
kostja94/marketing-skills
anthropics/claude-code
mblode/agent-skills
github/awesome-copilot
leonxlnx/taste-skill
sickn33/antigravity-awesome-skills
Keeps context tight: axiom-swiftui-search-ref is the kind of skill you can hand to a new teammate without a long onboarding doc.
We added axiom-swiftui-search-ref from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
Keeps context tight: axiom-swiftui-search-ref is the kind of skill you can hand to a new teammate without a long onboarding doc.
axiom-swiftui-search-ref fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
axiom-swiftui-search-ref has been reliable in day-to-day use. Documentation quality is above average for community skills.
axiom-swiftui-search-ref has been reliable in day-to-day use. Documentation quality is above average for community skills.
axiom-swiftui-search-ref fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
Solid pick for teams standardizing on skills: axiom-swiftui-search-ref is focused, and the summary matches what you get after install.
axiom-swiftui-search-ref fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
axiom-swiftui-search-ref has been reliable in day-to-day use. Documentation quality is above average for community skills.
showing 1-10 of 52