Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoreData: Change fetchRequest to makeFetchRequest #726

Merged
merged 10 commits into from
Jul 6, 2020
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

### Breaking Changes

_None_
* CoreData: Changes `fetchRequest` auto-generated method to `createFetchRequest` to avoid ambiguous function usage.
[David Rothera](https://github.com/davidrothera)
davidrothera marked this conversation as resolved.
Show resolved Hide resolved

### New Features

Expand Down
4 changes: 2 additions & 2 deletions Documentation/templates/coredata/swift5.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal class MainEntity: NSManagedObject {
return NSEntityDescription.entity(forEntityName: entityName, in: managedObjectContext)
}

@nonobjc internal class func fetchRequest() -> NSFetchRequest<MainEntity> {
davidrothera marked this conversation as resolved.
Show resolved Hide resolved
@nonobjc internal class func createFetchRequest() -> NSFetchRequest<MainEntity> {
return NSFetchRequest<MainEntity>(entityName: entityName)
}

Expand Down Expand Up @@ -102,7 +102,7 @@ extension MainEntity {

```swift
// Fetch all the instances of MainEntity
let request = MainEntity.fetchRequest()
let request = MainEntity.createFetchRequest()
let mainItems = try myContext.execute(request)

// Type-safe relationships: `relatedItem` will be a `SecondaryEntity?` in this case
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Tests/Fixtures/Generated/CoreData/swift5/defaults.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion templates/coredata/swift5.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {{ import }}
return NSEntityDescription.entity(forEntityName: entityName, in: managedObjectContext)
}

@nonobjc {{ accessModifier }} class func fetchRequest() -> NSFetchRequest<{{ entityClassName }}> {
@nonobjc {{ accessModifier }} class func createFetchRequest() -> NSFetchRequest<{{ entityClassName }}> {
return NSFetchRequest<{{ entityClassName }}>(entityName: entityName)
}

Expand Down