{"id":22119546,"url":"https://github.com/agarunov/fetchkit","last_synced_at":"2025-07-25T12:32:48.368Z","repository":{"id":56911207,"uuid":"89081925","full_name":"Agarunov/FetchKit","owner":"Agarunov","description":"Lightweight Core Data fetch framework","archived":false,"fork":false,"pushed_at":"2019-11-23T17:06:18.000Z","size":65,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-01T12:38:58.827Z","etag":null,"topics":["coredata","ios","macos","swift","swift-framework","tvos","watchos"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Agarunov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-22T16:02:05.000Z","updated_at":"2020-02-14T19:23:53.000Z","dependencies_parsed_at":"2022-08-21T03:20:16.552Z","dependency_job_id":null,"html_url":"https://github.com/Agarunov/FetchKit","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agarunov%2FFetchKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agarunov%2FFetchKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agarunov%2FFetchKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agarunov%2FFetchKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Agarunov","download_url":"https://codeload.github.com/Agarunov/FetchKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227574219,"owners_count":17788147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coredata","ios","macos","swift","swift-framework","tvos","watchos"],"created_at":"2024-12-01T14:15:08.525Z","updated_at":"2024-12-01T14:15:09.243Z","avatar_url":"https://github.com/Agarunov.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FetchKit\n\nLightweight Core Data fetch framework.\n\nWith FetchKit you can easily fetch data from store without creating `NSFetchRequest`.\n\n## Usage\nExample Core Data entity\n```swift\n@objc(User)\nclass User: NSManagedObject {\n    @NSManaged var id: Int64\n    @NSManaged var firstName: String?\n    @NSManaged var lastName: String?\n    @NSManaged var salary: Int64\n}\n\nextension User: QueryProtocol { }\n```\n\n### Find first\nFind first `User`. Sorted by firstName.\n```swift\nlet user = try? User.findFirst()\n    .sorted(by: \\User.firstName)\n    .execute(in: context)\n```\n\n### Find all\nFind all `Users` with first name John\n```swift\nlet allJohns = try? User.findAll()\n    .where(\\User.firstName, equals: \"John\")\n    .execute(in: context)\n```\n\n### Find range\n```swift\nlet ranged = try? User.findRange(2..\u003c5)\n    .sorted(by: \\User.id)\n    .execute(in: context)\n```\n\n### Get count\n```swift\nlet usersCount = try? User.getCount()\n    .execute(in: context)\n```\n\n### Min\nAggregate minimimum value of entity property\n```swift\nlet minId = try? User.getMin(keyPath: \\User.id)\n    .execute(in: context)\n```\n\n### Max\nAggregate maximum value of entity property\n```swift\nlet maxId = try? User.getMax(keyPath: \\User.id)\n    .execute(in: context)\n```\n\n### Delete\nDelete all `Users` with first name John and returns count\n```swift\nlet deleteCount = try? User.deleteAll()\n    .where(\\User.firstName, equals: \"John\")\n    .execute(in: context)\n```\n\n### Get Distinct\nFetch dictionaries (instead of managed objects) with specified properties and aggregation functions.\nResult can be grouped by properties (SQL GROUP BY)\n```swift\nlet result = try User.getDistinct()\n    .propertiesToFetch([\\User.firstName])\n    .aggregate(keyPath: \\User.salary, function: \"sum:\", saveAs: \"totalSalary\")\n    .group(by: \\User.firstName)\n    .execute(in: context)\n```\n\n### Fetched results controller\nReturn `NSFetchedResultsContoller` and perform fetch\n```swift\nlet userFetchedResults = try? User.fetchResults()\n    .group(by: \\User.firstName)\n    .sorted(by: \\User.firstName)\n    .sorted(by: \\User.lastName)\n    .execute(in: context)\n```\n\n## Requirements\n\n- iOS 8.0+ / macOS 10.9+ / tvOS 9.0+ / watchOS 2.0+\n- Xcode 11.0+\n- Swift 5.1+\n\n## Installation\n\n### CocoaPods\nTo integrate FetchKit into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\npod 'FetchKit'\n```\n\n## License\nFetchKit is released under the BSD license. See [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagarunov%2Ffetchkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagarunov%2Ffetchkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagarunov%2Ffetchkit/lists"}