To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/StewartLynch . The first 200 of you will get 20% off Brilliant’s annual premium subscription.
Excellent tutorial series! I really like the fact that you point out the compilation issues presented when doing the refactoring, what the error messages actually mean and the steps to perform to fix the problems. Sometimes the error verbiage is not very helpful but you do a great job explaining things in a way that everyone can understand. Looking forward to the next section of videos!
these first 3 in this SwiftData were fantastic for comparing to everything I had learned in CoreData recently. Most of the tutorials I had used being a few years old I was happy to see so many little newer features of iOS17 sprinkled all over !
Thank you, Stewart! Great video! I can't help but reflect on the ability to do iterative development these days, while remembering the old days with pencil writing code, punching cards, and iteratively submitting batch jobs until you get something that would compile, let alone do anything useful.
Great third part. But swift gets quite messy, I would love to see some guidelines/best practices on the topic. It does seem that SwiftData is closely related to CoreData.
Excellent series so far, thanks Stuart. 🙂 Are you going to cover mirroring SwiftData with CloudKit? I’d love to know if you found a good way to tell when CloudKit has finished syncing (for pre-loading some data on a new device purposes). I’m finding that a bit tricky.
Great series... I tried filtering on a value such as book then tried to do an inline edit of the list but when I do this it changes the filter and my item disappears from my list... is there a way to do the filtering and also inline edit of the list item? Just to be a little more specific, if I query on the author name but then realize I misspelled the author's name and try and change the name, the item disappears from my list because the authors name no longer fits my filter... If I did a delete on the name to change it then the book now has no author listed in my model... hope that makes sense. Thanks a lot for this series!
In the current implementation you can either show in shelf -> in progress -> completed or the reverse. How could you filter just a specific status like in progress? Is it possible to do with an enum?
I have a question. When i have a model class called Destination. It has as one of the properties : var city: String. I decorate this to be unique with @Attribute(.unique) so that if someone tries to insert a new Destination with the same city name, the model will simply be updated, and not duplicated. However, when i tested it, there was a crash. Swift data crashes every time a duplicate is inserted. Why is this happening? How come an app crash as soon as you decorate something with unique attribute. ??
Could be a SwiftData bug. I never use this and always would check using a contains code check. As far as destinations go though, there are many cities with the same name.
Are you certain it’s safe to access the query object directly using the _ version of the name, as in _books = Query(…. ? That seems a lot like a private implementation detail that isn’t intended to be stable. It also seem to be undocumented. I’m glad you demonstrated this technique but it’s unclear whether it’s a good practice or not.
That is not private. The _ is how you can update a query on initialization. It is how Apple does it in their sample project too. It is the only way to do it AFAIK
Great video series 👍, if I wanted to remember my preferred sort method, each time I opened the app, how might I do that. Ps sorry if I missed it in the video if its already there.
@@gakkieNL Right. You are displaying only the rawValue of the sort order in the picker, so you want to ,are sure that when you select one, it is the actual sortOrder that is bound to the variable, so that is why you need the tag.
Many thanks for the great Videos. Unfortunately, swiftdata is still far too cumbersome. It was much better many years ago in other programming languages. Maybe one day Apple will manage to integrate a good "real" sql database into SwiftUI