TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

SwiftData by Example: Is there a Swift Data equivalence for NSEntityDescription used in a deep copy?

Forums > Books

My Core Data app manages data about 3D objects used in a 3D modeling system. In Core Data, a 3D object is represented by instances of various entities (Swift classes). For example, a human body might have a torso entity and an arm entity. A human body entity would have a relationship that links it to a torso entity and the torso entity would have relationships that linked it to left and right arm entities.

My app makes extensive use NSEntityDescription.insertNewObject(forEntityName:, into:) to duplicate a complex 3D object entity tree to create a new tree in Core Data.

Is there a SwiftData way to replace the NSEntityDescription.insertNewObject() function or to duplicate portions of SwiftData via a deep copy?

The only mention of NSEntityDescription in SwiftData by Example is in an error message on page 98. NSEntityDescription is not included in the list of Core Data to SwiftData equivalences on page 5.

3      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.