static func activityData(filteredBy filter: DeviceActivityFilter = .init(), using policy: DeviceActivityData.Policy = .cached) -> some AsyncSequence<DeviceActivityData, any Error>
Request device activity data using a filter.
> Important: You must add the Family Controls App & Website Usage capability to your app before you
attempt to use this function.
This capability adds the
<doc://com.apple.documentation/documentation/bundleresources/entitlements/com_apple_developer_family-controls_app-and-website-usage>
to your app.
In a compatible iPad or iPhone app running on visionOS or macOS, using this
function will always throw. For more information, see
<doc://com.apple.documentation/documentation/xcode/adding-capabilities-to-your-app/>.
Additionally, your app must be authorized and data access must be available
before using this function, or it will always throw. See
<doc://com.apple.documentation/documentation/familycontrols/authorizationcenter>
for more details.
- Parameters:
- filter: The filter to use when fetching activity data.
- policy: The policy to use when fetching activity data.
- Returns: A sequence of device activity data for the given filter.
get · iOS 16.0+
lastUpdatedDate
TypeScript
get lastUpdatedDate(): globalThis.Date
Swift declaration
var lastUpdatedDate: Date
The date when the system last updated the data for this device.
set · iOS 16.0+
lastUpdatedDate
TypeScript
set lastUpdatedDate(value: globalThis.Date)
Swift declaration
var lastUpdatedDate: Date
The date when the system last updated the data for this device.
get · iOS 16.0+
segmentInterval
TypeScript
get segmentInterval(): DeviceActivityFilter_SegmentInterval
Swift declaration
var segmentInterval: DeviceActivityFilter.SegmentInterval
The segment interval of each ``ActivitySegment`` in ``activitySegments``.
set · iOS 16.0+
segmentInterval
TypeScript
set segmentInterval(value: DeviceActivityFilter_SegmentInterval)
Swift declaration
var segmentInterval: DeviceActivityFilter.SegmentInterval
The segment interval of each ``ActivitySegment`` in ``activitySegments``.