How do you create a fetched property?



How do you create a fetched property?..

Answer / 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

More Apple iOS Interview Questions

What are some common execution states in ios?

1 Answers  


What’s the difference between mkannotation and mkpointannotation?

1 Answers  


Explain me what is arc? How it works?

1 Answers  


What is uikit framework in ios?

1 Answers  


Is ios multithreading?

1 Answers  


What are different instruments xcode supports for app profiling?

1 Answers  


What is arc in ios?

1 Answers  


Is ios development hard?

1 Answers  


Can we adjust the size of photos uploaded from the app?

1 Answers  


what is universal Application?

1 Answers  


Are ios developers in demand?

1 Answers  


Explain difference between mrc and arc?

1 Answers  


Categories