<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: -",
    "macOS: 10.5.0 -",
    "tvOS: 3.0.0 -",
    "visionOS: -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSManagedObjectContext/count(for:)-3r91z",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Data",
      "CoreData"
    ],
    "preciseIdentifier" : "s:So22NSManagedObjectContextC8CoreDataE5count3forSiSo14NSFetchRequestCyxG_tKSo0hI6ResultRzlF"
  },
  "title" : "count(for:)"
}
-->

# count(for:)

Returns a count of the objects the specified request fetches when it executes.

```
nonisolated func count<T>(for request: NSFetchRequest<T>) throws -> Int where T : NSFetchRequestResult
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)