SwiftData vs Core Data

I just saw Chris’s video on SwiftData and I think I’d really like to go that route on the next version of my app. Currently, my app has Core Data. It is a Pickleball app that contains lots of drills/teaching points. On each drill view, there is a button that, when clicked, adds the name of that drill to the “My Plan” list (basically a notes list) which is in a separate section (and it also adds the drill explanation into the notes as well). So, when the user goes to their My Plan list to pick a drill to work on, it will show on the list. Before I go full on into Swift Data, is this something that will be a capability in Swift Data?
Background: I’m not an expert coder by any means - just learned through tutorials (mainly Chris videos).

@adelman3

Welcome to the community.

SwiftData and Core Data are essentially the same database available on an iOS device. The difference is that SwiftData is a brand new API (available in iOS 17 and beyond) to interface the database and make the code more “Swift like” as it were, whereas the old (current) Core Data API was somewhat difficult to use or get your head around.

So in nutshell, the SwiftData API will not be available until Xcode 15 and iOS 17 are released (maybe September ???). For the time being you will have to stick to using Core Data in it’s current form.

Got it. Thanks so much. So, same capabilities just a more friendly interface as I understand your response. Do you think it will be fairly easy to convert a project from the current form of Core Data to the new SwiftData when it becomes available?

Exactly.

I think (???) there is a WWDC tutorial on SwiftData where there was a demo on that.

Great! Would you happen to know the link or in what section/day it’s in? I’ve been searching through each day and there doesn’t seem to be a search box to help find the topic.

You will need to download the Developer App for your Mac (if you have not already done so) and then choose WWDC23 from the left menu. Scroll down the topics to close to the end and you’ll find Migrate to SwiftData.

I find WWDC tutorials less than adequate. They generally lack detail leaving the viewer always saying “but what about…”.

Have a look and see how you go. Remember that using this new SwiftData API code requires Xcode 15 which is in Beta so if you only have Xcode 14 then this is all just theoretical stuff but you should be able to get an idea of how it will work.

1 Like

Fantastic! Thank you so much! I’m sure I’ll learn a lot as I prepare to convert to swiftdata.

Hello,
How are you?
Can you please send me the link of the WWDC tutorial on SwiftData?
Can’t find it.
Thanks a lot!

As advised in the July 14 post:

  • You will need to download the Developer App for your Mac (if you have not already done so) and then choose WWDC23 from the left menu. Scroll down the topics to close to the end and you’ll find Migrate to SwiftData.

Thanks a lot!