adspace
Answer Posted / Apurav Garg
"In iOS, to create a fetched property, you need to define it in the entity's managed object subclass. Here is an example:
```swift
import Foundation
import CoreData
@objc(YourEntity)
public class YourEntity: NSManagedObject {
@NSManaged public var propertyA: String?
@dynamic public var fetchedPropertyB: [YourOtherEntity]?
}
let fetchRequest = NSFetchRequest<YourOtherEntity>(entityName: "YourOtherEntity")
fetchedPropertyB = try? YourEntity.fetch(fetchRequest)
```"
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is latest xcode version?
In a single model, can I have few entities in one sqlite db file and remaining in another sqlite db file?
Explain parent-child context setup. How does it work? What are the advantages?
What are transient properties?
What is nsmanagedobjectcontext? What are the different concurrency types? Explain them.
How to handle concurrency problems in core data?
Why do all model object attributes get marked with @dynamic and not synthesised?
What is the purpose of reuseidentifier?
What's the latest version of ios?
What is latest version of ios?
What are the different store migration options? How do they work?
Why do all model object attributes get marked with @dynamic and not synthesised? What does @dynamic mean?
What is dependency management tools?
What is latest ios version?