A great introduction to SwiftData and lots of new modifiers for SwiftUI along the way. Enjoyed following along and now I'm reading about Databases in general curious about all things database :for even bigger apps I'd like to attempt )
Thank you very much! It's a pity that SwiftData currently only supports the private db and not also the shared db as Coredata does. Sharing data with all devices for a user has also some pitfalls. I have an app which creates some default entries as long as the tables are empty (e.g. currencies, countries...) When a user opens the app on two different devices, all entries are being duplicated, that's the normal behavior of CloudKit sync, as long as CloudKit doesn't support unique entries. I had to modify the app so that the user has to press a button to generate the default together with an indication of what can happen.
That was a really informative and explanatory videos. Thank you for your hard work. Much appreciation for your dedication to the iOS development community.
Great video, Stewart! Thank you for all the work you put in to make them. This afternoon I lost all my TH-cam subs and history. Really don't know how that can happen. So I'm resubbing.
It turns out it was Google Chrome that made my TH-cam profile disappear. As you can see in this post, all is well with Safari. My solution is to just quit using Chrome for now.
I know I commented on an earlier video in this series that I hope WWDC brings us CloudKit sharing, but is it currently possible to use SwiftData in conjunction with CoreData to achieve CloudKit sharing? And if so is this something you would ever consider making an additional video to add to this series? Either way, this is without a doubt the best taught and most complete tutorial on SwiftData that I have seen (with so many non-SwiftData nuggets along the way). This is a masterclass and thank you so much for putting this together!
Hi Stewart - Thanks for the great tutorial - Any notes on adding a toggle to allow the user to choose if they want iCloud syncing. I've tried for 2 days, but no matter what it always syncs.
So the big lesson I gathered - is IF I'm going to use Cloud Kit - start here at this lesson first! Glad I watched them all for a first pass.... before starting my own project. I'm wondering if I can uses your Book list as a launching point ? Hmmm I bet so.
I got the project I used in the video on GitHub and ran it, but the Cloud function doesn't work. What should I do?? I can't speak English. Is there anything I missed in the video?? I can see the my containers in cloud consol, but not work cloud sync with my two iphone device
Quick question from someone fairly new to this: If I'm building an iOS app now, and at a later point want to build iPadOS and MacOS versions of the app, can I link all three apps to the same data in CloudKit?
Yes, but I would recommend that you use the same project. For iPad, you can just edit your iOS app to handle different class sizes. The code should basically be the same. For the Mac, you can just add a new target and use the same bundleId
Hi there! Do you know a way how add iCloud sync only for some @Model? For example I have Model1 and Model2. The Model1 should be stored in local database and Model2 should sync with iCloud. This is project with SwiftData. Thanks in advance!
Hey Stewart, using the date.distantPast inside a Picker I get a date of Dec 1, 1 (e.g. year 1) but then the picker controls cannot mutate that date - for some unknown reason. Have you seen this problem?
Thank you Stewart. Your videos always show up just when I’m working through something in your new video. Would you consider going over CloudKit’s shared database option sometime? I’d like to find an Apple way of allowing multiple users to share a single database.
@@StewartLynch thanks, so that means I am not able to disable cloudkit for some users and enable it for some? Can users have some toggle in the app where they can disable syncing to cloudKit or they need to do it manually in iPhone's Settings app?
I already use SwiftData and wanted to adopt CloudKit so my app had a backup in case it is ever reinstalled. Do you know a good way to do this? It seems there isn't a good way to see if you have mirrored all the data from the cloud...
You can adopt CloudKit, but existing data will not get pushed up to the cloud automatically. You could create your own backup service and I do this a lot. I create a JSON file for all of the data and export any images as JSON and use a ZipFoundation Swift Package to zip up the contents and save to an external directory. I can then reverse the process if I want to restore to that last backup.
Loving this! I’ve done some minimal work with CloudKit and CoreData…. Wow this is just “magical”, in comparison. I’m sure Apple will enhance it to allow public database, at some point. For some reason, I’m not seeing “my” Zone. I’m only seeing the “_default zone”. I have “Private Database”, “_default Zone (only one available), and I select record type and I see all the tables (records). I can even see the fields. I added the basic index, and when I query, I get no books? How do I get the dashboard to update and show correct zone? Thanks…..
Excellent Series. Allowed me to get my own project up and running. One question/concept. If I wanted to have a reference Schema/Model that would be shared across any user...Example: table of Shoe Sizes. The idea is that I would query those into an Array and then place them in a PickerView. Rather than "hard code" since the sizes might change over time, my idea is that I could have a reference table in the Public Database to @Query from? Is this possible? If so, any ideas to get me started. OR would you recommend a different approach?
@@StewartLynch Thank you...perhaps you might add a chapter or two on this series if that becomes available. Either way, thanks again for the great content! Great instructor!! :) I need to now go buy you a coffee
What a masterful performance this series has been. Love how you sprinkle useful tips here and there.
Thank you
Excellent and very informative tutorial series Stewart. Your teaching style is great, making it easy to absorb - thank you 🙏
A great introduction to SwiftData and lots of new modifiers for SwiftUI along the way. Enjoyed following along and now I'm reading about Databases in general curious about all things database :for even bigger apps I'd like to attempt )
Thank you very much! It's a pity that SwiftData currently only supports the private db and not also the shared db as Coredata does. Sharing data with all devices for a user has also some pitfalls. I have an app which creates some default entries as long as the tables are empty (e.g. currencies, countries...) When a user opens the app on two different devices, all entries are being duplicated, that's the normal behavior of CloudKit sync, as long as CloudKit doesn't support unique entries. I had to modify the app so that the user has to press a button to generate the default together with an indication of what can happen.
That was a really informative and explanatory videos. Thank you for your hard work. Much appreciation for your dedication to the iOS development community.
Great video, Stewart! Thank you for all the work you put in to make them. This afternoon I lost all my TH-cam subs and history. Really don't know how that can happen. So I'm resubbing.
It was Google Chrome doing it to me. All is well in Safari.
It turns out it was Google Chrome that made my TH-cam profile disappear. As you can see in this post, all is well with Safari. My solution is to just quit using Chrome for now.
Thank you so much Stewart ...💯🔥 for all your efforts 🇨🇦
You are very welcome
Great tutorial my friend. I’ve learned a lot.
Glad to help
Thanks for your excellent job with this serie.
That is great material Mr. Lynch! Congrats.
my god this was the best tutorial on CloudKit and SwiftData integration
Glad you enjoyed it
I know I commented on an earlier video in this series that I hope WWDC brings us CloudKit sharing, but is it currently possible to use SwiftData in conjunction with CoreData to achieve CloudKit sharing? And if so is this something you would ever consider making an additional video to add to this series? Either way, this is without a doubt the best taught and most complete tutorial on SwiftData that I have seen (with so many non-SwiftData nuggets along the way). This is a masterclass and thank you so much for putting this together!
I am going to hold off on this until after WWWDC. Thanks for the compliments though.
Hi Stewart - Thanks for the great tutorial - Any notes on adding a toggle to allow the user to choose if they want iCloud syncing. I've tried for 2 days, but no matter what it always syncs.
So the big lesson I gathered - is IF I'm going to use Cloud Kit - start here at this lesson first!
Glad I watched them all for a first pass.... before starting my own project. I'm wondering if I can uses your Book list as a launching point ? Hmmm I bet so.
The key is to start here before you have a lot of data entered.
I got the project I used in the video on GitHub and ran it, but the Cloud function doesn't work. What should I do??
I can't speak English. Is there anything I missed in the video??
I can see the my containers in cloud consol, but not work cloud sync with my two iphone device
6:52 the “not allowing @Unique properties” part is baffling. I hope they fix this at some point
Quick question from someone fairly new to this: If I'm building an iOS app now, and at a later point want to build iPadOS and MacOS versions of the app, can I link all three apps to the same data in CloudKit?
Yes, but I would recommend that you use the same project. For iPad, you can just edit your iOS app to handle different class sizes. The code should basically be the same. For the Mac, you can just add a new target and use the same bundleId
@@StewartLynch thank you
Great, thanks a lot ! 😄
Hi there! Do you know a way how add iCloud sync only for some @Model? For example I have Model1 and Model2. The Model1 should be stored in local database and Model2 should sync with iCloud. This is project with SwiftData. Thanks in advance!
I personally am not aware of any way to do that, but I have not really looked in to it to see if it is possible.
@@StewartLynch I was able to achieve this by having two ModelContainers with different schemas.
Hey Stewart, using the date.distantPast inside a Picker I get a date of Dec 1, 1 (e.g. year 1) but then the picker controls cannot mutate that date - for some unknown reason. Have you seen this problem?
I fix these issues in the last video
Thank you Stewart. Your videos always show up just when I’m working through something in your new video.
Would you consider going over CloudKit’s shared database option sometime? I’d like to find an Apple way of allowing multiple users to share a single database.
Unfortunately this is not possible with SwiftData
Great series!
Is there a way to add Cloud sync in app only for some(e.g. subscribed) users? Or it is available by default for everyone?
There is no shared containers yet in CloudKit for SwiftData
@@StewartLynch thanks, so that means I am not able to disable cloudkit for some users and enable it for some? Can users have some toggle in the app where they can disable syncing to cloudKit or they need to do it manually in iPhone's Settings app?
@@dodilodi1278Good point. They probably would need to do it in settings but not sure so hopefully he replies 👍🏻
I already use SwiftData and wanted to adopt CloudKit so my app had a backup in case it is ever reinstalled. Do you know a good way to do this? It seems there isn't a good way to see if you have mirrored all the data from the cloud...
You can adopt CloudKit, but existing data will not get pushed up to the cloud automatically. You could create your own backup service and I do this a lot. I create a JSON file for all of the data and export any images as JSON and use a ZipFoundation Swift Package to zip up the contents and save to an external directory. I can then reverse the process if I want to restore to that last backup.
Hmm. It's telling me that I can't set up icloud as a personal developer. Does any know if that's valid?
Do you have a paid developer account?
@@StewartLynchdamn, how much does that cost?
Loving this! I’ve done some minimal work with CloudKit and CoreData…. Wow this is just “magical”, in comparison. I’m sure Apple will enhance it to allow public database, at some point. For some reason, I’m not seeing “my” Zone. I’m only seeing the “_default zone”. I have “Private Database”, “_default Zone (only one available), and I select record type and I see all the tables (records). I can even see the fields. I added the basic index, and when I query, I get no books? How do I get the dashboard to update and show correct zone? Thanks…..
Never mind…. I use a different iCloud Account doing development, than is my AppleID for my Developer Account - DUH!!!! Ha ha
Excellent Series. Allowed me to get my own project up and running. One question/concept. If I wanted to have a reference Schema/Model that would be shared across any user...Example: table of Shoe Sizes. The idea is that I would query those into an Array and then place them in a PickerView. Rather than "hard code" since the sizes might change over time, my idea is that I could have a reference table in the Public Database to @Query from? Is this possible? If so, any ideas to get me started. OR would you recommend a different approach?
Shared CloudKit containers are not supported with SwiftData yet (Maybe coming this year? 🤞)
@@StewartLynch Thank you...perhaps you might add a chapter or two on this series if that becomes available. Either way, thanks again for the great content! Great instructor!! :) I need to now go buy you a coffee
Ein anderer(localized 😀) great tutorial. It looks( to me) like CloudKit has more problems than it is worth at this time.
If you disable the cloud sync in the Settings for your app, all data on that device is lost.
Why would you want to do that?
Excellent
Thanks
also if anyone is having issues with data not showing up on their Production environment, try "import Cloudkit" wherever you are importing SwiftData