/capacitor-spotlight-search

Primary LanguageSwiftApache License 2.0Apache-2.0

🚨🚨🚨 THIS PLUGIN IS STILL IN DEVELOPMENT 🚨🚨🚨

capacitor-spotlight-search

Capacitor plugin for iOS Spotlight search functionality

Heavily inspired by react-native-spotlight-search

Make shout-out to jdmunro (Author of react-native-spotlight-search) for the idea and some code inspiration.

preview (also from react-native-spotlight-search):

Spotlight Search Demo

Install

npm install capacitor-spotlight-search
npx cap sync

API

indexItems(...)

indexItems(items: SpotlightItem[]) => Promise<void>
Param Type
items SpotlightItem[]

indexItem(...)

indexItem(item: SpotlightItem) => Promise<void>
Param Type
item SpotlightItem

getIndexedItemsIdentifiers()

getIndexedItemsIdentifiers() => Promise<string[]>

Returns: Promise<string[]>


deleteItemsWithId(...)

deleteItemsWithId(id: string[]) => Promise<void>
Param Type
id string[]

deleteAllItems()

deleteAllItems() => Promise<void>

Type Aliases

SpotlightItem

Property Description Type Required
title The title of the search item. string Yes
contentDescription A description which appears below the title in the search results. string No
uniqueIdentifier A unique and stable identifier. Used to refer to the item. string Yes
domain A string for grouping related items together in a way that makes sense. Not displayed to the user. string Yes
thumbnailName A local file name/key to a thumbnail image. See A Note About Thumbnails. string No
thumbnailData A base64 string representation of a thumbnail image. See A Note About Thumbnails. string No
keywords An array of keywords which can be used to help inform the search index. Not visible to the user. [string] No

TODO

  • add handler to open app from spotlight search with specific item
  • Android support (is it even possible?)