Contents

count(for:)

Returns the number of objects the specified request fetches when it executes.

Declaration

func count(for request: NSFetchRequest<any NSFetchRequestResult>) throws -> Int

Parameters

  • request:

    A fetch request that specifies the search criteria for the fetch.

Return Value

The number of objects a given fetch request would have returned if it had been passed to fetch(_:), or NSNotFound if an error occurs.

See Also

Registering and fetching objects