---
title: SRFetchRequest
framework: sensorkit
role: symbol
role_heading: Class
path: sensorkit/srfetchrequest
---

# SRFetchRequest

An object that defines the criteria for a sample query.

## Declaration

```swift
class SRFetchRequest
```

## Overview

Overview An app configures an instance of this class to select the device from which to query sensor data. The time range (from, to) specifies when the framework records the data. A fetch query can retrieve only sensor data that the app records by first calling startRecording(). To execute a fetch request, an app passes the instance of this class to its sensor reader’s fetch(_:) function. The framework notifies the sensor reader’s delegate upon fetch-request completion with sensorReader(_:didCompleteFetch:). If the fetch fails, the framework calls the delegate’s sensorReader(_:fetching:failedWithError:). SensorKit places a 24-hour holding period on newly recorded data before an app can access it. This gives the user an opportunity to delete any data they don’t want to share with the app. A fetch request doesn’t return any results if its time range overlaps this holding period.

## Topics

### Selecting the Device

- [device](sensorkit/srfetchrequest/device.md)
- [SRDevice](sensorkit/srdevice.md)

### Defining the Time Range

- [from](sensorkit/srfetchrequest/from.md)
- [to](sensorkit/srfetchrequest/to.md)
- [SRAbsoluteTime](sensorkit/srabsolutetime.md)
- [current()](sensorkit/srabsolutetime/current().md)
- [toCFAbsoluteTime()](sensorkit/srabsolutetime/tocfabsolutetime().md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Querying data

- [SRFetchResult](sensorkit/srfetchresult.md)
