SwiftData Migrations | SwiftData Tutorial | #11

  Рет қаралды 4,338

tundsdev

tundsdev

Күн бұрын

Пікірлер: 45
@homerreal
@homerreal 16 күн бұрын
No cap one of THE best tutorials on swiftdata migration/versioning
@andrejkling3886
@andrejkling3886 9 ай бұрын
Best series on Tube...💯🔥 thanks a lot Tuns 🥇
@mullassery
@mullassery 8 ай бұрын
Excellent video. No fluff; all value 👌
@tundsdev
@tundsdev 8 ай бұрын
Glad you enjoyed it!
@Kontrbandist
@Kontrbandist 6 ай бұрын
Hey mate, thanks for the tutorial, finally got a better understanding about Migration which been struggling. Cheers!
@tundsdev
@tundsdev 6 ай бұрын
Glad it helped!
@robertj1679
@robertj1679 4 ай бұрын
DUDE! Thank you SO much for this video so many other tutorials do not address handling multiple models!
@tundsdev
@tundsdev 4 ай бұрын
Glad it helped!
@dmacharo
@dmacharo 7 ай бұрын
Man this is absolute gold! Thanks heaps!
@tundsdev
@tundsdev 7 ай бұрын
Glad you enjoy it 👌🏾
@dmacharo
@dmacharo 7 ай бұрын
​@@tundsdev, if we are changing only one model, should we include all models in the migration or just the one? I am getting a crazy error "Cannot use staged migration with an unknown coordinator model version." and not sure what else to try!
@tundsdev
@tundsdev 7 ай бұрын
@dmacharo You need to copy everything over, migrations can be a bit flaky in swiftdata i’ve realised even adding a transformable property or enums can make your app crash… So for now i’d make the models like for like 👌🏾
@RyanTaylorGT
@RyanTaylorGT Ай бұрын
Super helpful, thank you!
@tundsdev
@tundsdev Ай бұрын
Glad it was helpful!
@maryannadelman4438
@maryannadelman4438 6 ай бұрын
I have an app that has a watch component. Both watch and phone have the same SwiftData Model for persisting data. I’ve been searching on how to have the data that the user stores on the watch able to be sent to the phone so they can have it on their phone for comparison. Hope that makes sense. I’m a relative newbie but have learned a lot through people like you.
@tundsdev
@tundsdev 6 ай бұрын
Hey. I feel like you want to enable App Groups on your SwiftData model to share the data between two devices. I’d look into using app groups with SwiftData 👌🏾
@lib9892
@lib9892 10 ай бұрын
Thank you so much for all you done, it's very helpful for me! Liked, subscribed and commented!
@avgeekguy
@avgeekguy 11 ай бұрын
Could you do a video on how to do alternate app icons and have the user select which one they want? Great video as always!
@tundsdev
@tundsdev 11 ай бұрын
Cool idea for sure 👌🏾
@Jake-b4s
@Jake-b4s 3 ай бұрын
Very detailed tutorial 👍
@user-zl6qv9vn1z
@user-zl6qv9vn1z 6 ай бұрын
Subject suggestion: Transferring SwiftData model from watch to phone. I could definitely use a tutorial on that one!
@tundsdev
@tundsdev 6 ай бұрын
Can you explain this one a bit more?
@bscheirman
@bscheirman Жыл бұрын
You had me at 2Pac and lost me at McDonald’s 😂
@tundsdev
@tundsdev Жыл бұрын
McDonalds is easily the creme de la crem of fast food 🤷🏾‍♂️
@tiIIus
@tiIIus 11 ай бұрын
Thank you, very helpful! Could you make a video on how to implement a fully working subscription just with StoreKit 2 and the new SwiftUI SubscriptionStoreView?
@tundsdev
@tundsdev 11 ай бұрын
It’s already in the works 👀, I really appreciate the support and don’t forget to subscribe & share the channel 🙏🏾
@Artifismo
@Artifismo 7 ай бұрын
My Application Support is Empty after adding some records.
@aprilzoo9561
@aprilzoo9561 Жыл бұрын
Hey, love you vids: ) Have you considered doing a video explaining the sample code project Backyard Birds from Apple? I'd love to get your take on why the app is setup the way it is: - multiple ViewModifiers - instance of the DataGeneration - Account setup - StoreKit I'm especially interested in what exactly happens, when the app is launched for the first time and how the subsequent app launches are handled. Take care : )
@tundsdev
@tundsdev Жыл бұрын
I’ve not actually, but do you mean like a code review? It’s something i could do & consider for sure 👌🏾
@aprilzoo9561
@aprilzoo9561 Жыл бұрын
Yes! Apple has multiple videos, where they explain things like storekit or widgets using Backyard Birds. However, there aren't any good resources on how the app actually works and why certain design decision were made@@tundsdev
@tundsdev
@tundsdev Жыл бұрын
Cool for sure i’ll look into it, great suggestion 👌🏾
@federicoramos
@federicoramos 2 ай бұрын
I've been getting an exception "Thread 1: "The current model reference and the next model reference cannot be equal." Does anyone have a suggestion?
Ай бұрын
Great video 👍 thanks Is it possible to migrate while using CloudKit?
@tundsdev
@tundsdev Ай бұрын
Yh you should be able too, you'd just have to enable icloud syncing on your container in your future app release and the schemas you have at that time would then by synced to icloud. You can check out the icloud vid on ym channel too
@w0mblemania
@w0mblemania Жыл бұрын
This is very useful, thank you. A question: when it comes to adding a new property like "isArchived" and "isFlagged", wouldn't automatic migration automatically set such values to false, rather than nil? Cheers.
@tundsdev
@tundsdev Жыл бұрын
Thanks & it depends on the type. If it was optional then yh it can be nil. But its non optional you have to add a default value. So it would be whatever you set it can’t assign a value to non optional automatically
@w0mblemania
@w0mblemania Жыл бұрын
@@tundsdev Cheers.
@joe-su3
@joe-su3 3 ай бұрын
@@tundsdev Since there is already a default value, why do we still need to set the value in the database in didMigrate? If null values are an issue, the line context.fetch(FetchDescriptor()) would have already caused a crash.
@chris_bennett
@chris_bennett Жыл бұрын
Great video, as always🔥! One question about ToDosSchemaV3: do we need to keep the @Attribute(originalName: "timestamp")? Renaming was already taken care of in V2…
@tundsdev
@tundsdev Жыл бұрын
Thanks & probably not since it’s already been renamed in V2 like you say 👌🏾, that’s what I get for copying and pasting code 😂
@tundsdev
@tundsdev Жыл бұрын
So this isn't actually the case you do need this Attribute, I just tested this out in a different scenario and the app crashed for me when i added another migration plan so i'd leave this in place
@chris_bennett
@chris_bennett Жыл бұрын
@@tundsdev thanks so much for your additional testing and follow up 💯
@mikehimself909
@mikehimself909 Жыл бұрын
Thank you for this great video. A question on your versioning: Even though your renaming of ‘timestamp’ to ‘due date’ is small, it is a breaking change. If I’m running the app on two devices, and I update one of them to the latest version and run it, then the MySQL database will have the renamed column/property. The other device will or should fail (since it can’t find ‘timestamp’). Ideally, the other one would get an exception like ‘you must upgrade to the latest version before running this app’. Do you know if changing major or minor versions will prevent incompatible versions from accessing the database after it’s upgraded?
@tundsdev
@tundsdev Жыл бұрын
👋🏾 technically it shouldn’t be a problem since this isn’t like MySQL. The persistent storage isn’t on a server its local to the device so you’d be ok using the app until you updated it to a later version. It’s only when you update the app the migration would happen, and this then would perform either a lightweight or heavyweight migration for you 👌🏾
SwiftData Debugging The Easy Way | SwiftData Tutorial | #11
14:03
POV: Your kids ask to play the claw machine
00:20
Hungry FAM
Рет қаралды 17 МЛН
Beginner's Crash Course to Elastic Stack -  Part 1: Intro to Elasticsearch and Kibana
56:42
Swift Data Relationships 🚀 | SwiftData Tutorial | #2
26:52
1. SwiftData CRUD Operations
42:40
Stewart Lynch
Рет қаралды 27 М.
3. SwiftData Dynamic Sorts and Filters
18:50
Stewart Lynch
Рет қаралды 6 М.