NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

Change value of an object in one-to-many - Core Data

Forums > SwiftUI

Hi everyone! I was follow this tutorial

And I have a question, how can I change the value of an object in this one-to-many scenario? Let's say that, in Paul's example, I want to update the name of some of the candy:

let candy1 = Candy(context: moc) = "Mars"
candy1.origin = Country(context: moc)
candy1.origin?.shortName = "UK"
candy1.origin?.fullName = "United Kingdom"

For example, Mars to any other name. Is there a way to do that?



You mean in the example above or in the future dynamically?


I mean, once the object is already created and in the future I want to change a value (for example, the name)


Hacking with Swift is sponsored by Play

SPONSORED Play is the first native iOS design tool created for designers and engineers. You can install Play for iOS and iPad today and sign up to check out the Beta of our macOS app with SwiftUI code export. We're also hiring engineers!

Click to learn more about Play!

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.