Skip to main content
The API of the expo-rollup module. Expo and React Native explains how to install it. Each function wraps a call of the Swift SDK, and each value has the fields of its Swift type, in the shapes below. The package ships these TypeScript types.

Setup

configure

Sets up the SDK with your app’s publishable key and what to index. Options you leave out keep the SDK’s defaults: the last three months, growing, of photos, screenshots and videos. Call it once when your app starts. Calling it again changes the options, and the index follows them. Rejects with missingRequirement when the app lacks something the SDK needs, and with simulatorUnsupported in the iOS Simulator.

requestPhotoAccess

Shows the system Photos prompt (once) and returns the person’s answer. Call it right after the person chooses to turn the feature on: a grant starts the first index, which continues in the background.

startIndexing

Starts indexing, or lets it continue in the background. Call it from a user action, such as a button press.

getIndexOptions

The index options in effect.

reset

Deletes everything the SDK keeps: the index, downloaded models and places, queued reports, and this device’s record on Rollup’s server. Indexing starts again from scratch the next time it starts.

Indexing state

useIndexingState

A React hook that keeps the indexing state current. It is null until the first state arrives, and always null where Rollup is not available.

getIndexingState

Where indexing is now.

addIndexingStateListener

Calls listener with the current state and every change after it, until you call remove().

isSearchable

Whether search, query and profile have an index to read: the state is ready, or indexing with searchable true.

Search, query and profile

Searches the index on the iPhone: dates, places, media and what photos show or say. Results come most relevant first. See Search.

query

Answers a question about the person’s life from the index. The model runs on Rollup’s server; its tools run on the iPhone, and only their text results leave it. Tell the person and get their permission first. See Query and Privacy.

profile

Fills a JSON Schema (an object schema) about the person from the index: the schema’s shape exactly, null where their life does not say, with the photos behind each filled field. Pass the schema as an object. Same permission as query. See Profile.

Availability

isAvailable is true on iOS with the native module linked. Elsewhere it is false, sdkVersion is null, and every call rejects with unsupportedPlatform.

Helpers

indexWindow.growing reaches back from and keeps adding new photos; nothing ages out. indexWindow.sliding keeps only the most recent span, and removes older photos as time passes.

Types

Enums are objects tagged by type. Dates are ISO 8601 strings.

IndexingState

searchable means search, query and profile already work on the photos indexed so far.

PhotoAccess

IndexOptionsInput and IndexOptions

configure takes the fields to change; every field you leave out keeps the SDK’s default. getIndexOptions returns every field. See Index options for what each one does.

SearchResults

See SearchResults for what each field means.

Answer

Profile

json is a parsed object, not a string. Pass your own type to profile<T>() to type it. Keys of evidence are JSON Pointers, such as /food/favorite_cuisine.

JSONValue

Errors

Every call rejects with a RollupError:
message is for developers, not for the person. A failed indexing state carries the same fields as a plain object (RollupErrorBody).
Every code but the last two comes from the Swift SDK. See RollupError for what each one means and Troubleshooting for what to do.