Intro to SwiftData - Model, Container, Fetch, Create, Update & Delete

  Рет қаралды 78,699

Sean Allen

Sean Allen

Күн бұрын

Пікірлер
@seanallen
@seanallen Жыл бұрын
Learn more with my iOS Developer courses at seanallen.teachable.com
@AndrewDChristie
@AndrewDChristie Жыл бұрын
I've been watching for a while, I like Sean's teaching style - he has a great way of making complex concepts simple and understandable
@seanallen
@seanallen Жыл бұрын
I appreciate the long-time support, Andrew!
@Spacer-l3j
@Spacer-l3j 8 ай бұрын
thanks boss. I do like content creators who doesn't read the course material but instead is thinking logical, it gives me the vibe that you a pro
@seanallen
@seanallen 8 ай бұрын
I appreciate that!
@bradleygilmore
@bradleygilmore Жыл бұрын
This was by far the best SwiftData video I've seen. Thank you!
@michaelbouril5278
@michaelbouril5278 10 ай бұрын
This is just incredible, your level of mastery and ability to step through each portion with great clarity is unheard of!
@seanallen
@seanallen 10 ай бұрын
I appreciate the kind words and glad you liked the video!
@VTivan
@VTivan Жыл бұрын
Great video, as usual. Would be great a part 2 explaining the iCloud sync with SwiftData
@TVsBen
@TVsBen Жыл бұрын
Yes I would love part 2! I have CloudKit enabled on a SwitData project but I'm not understanding how to get it to sync.
@seanallen
@seanallen Жыл бұрын
More Swift Data videos in the future for sure. No promises on when, but there's a few on my to-do list.
@naeem3dful
@naeem3dful Жыл бұрын
Hey Sean, I just wanted to let you know how much I appreciate the way you present and explain new things. Your videos make complex topics seem so simple and understandable. It's clear that you have a talent for breaking things down. Thanks for making data storage seem so much easier in your beautiful way. Keep up the fantastic work!
@seanallen
@seanallen Жыл бұрын
I really appreciate the kind words and it's motivation to keep going 💪. Glad you're enjoying the content!
@DD-hh3sp
@DD-hh3sp 11 ай бұрын
Love your style, Sean. You explain things well and make it understand. Thanks!
@DD-hh3sp
@DD-hh3sp 11 ай бұрын
*understandable.
@seanallen
@seanallen 11 ай бұрын
I appreciate that! Glad you like my teaching style.
@SaschaBuerk
@SaschaBuerk Жыл бұрын
Just started to dip my toes into iOS development and I wasn't aware how recent some of the things I try to use are. It's so hard to find guides. So this is perfect.
@seanallen
@seanallen Жыл бұрын
Happy to help 👍
@TheEmperorXavier
@TheEmperorXavier Жыл бұрын
I just discovered your channel and I’m watching your Swift UI Fundamentals Video. You keep dropping these fire videos which is helping me understand SwiftUI a lot. Thanks soo much and I greatly appreciate your valuable work.
@seanallen
@seanallen Жыл бұрын
Welcome to the channel! Glad you're enjoying the content :)
@sandeep_hegde
@sandeep_hegde Жыл бұрын
I've watched several tutorials on SwiftData, but this one stands out as the best introduction to the topic so far. Sean has a unique talent for simplifying complex concepts and making them easily understandable. Thanks Sean. 🙌"
@87Avantgarde
@87Avantgarde 8 ай бұрын
Dear Sean, thank you for that wonderful video. Love your teaching style, it’s easy for me to understand and follow you. Just excellent.
@seanallen
@seanallen 8 ай бұрын
Glad you like my style!
@timotejmatlak4625
@timotejmatlak4625 10 ай бұрын
Thank you Sean, you are the best teacher with the best content ever :)
@seanallen
@seanallen 10 ай бұрын
Thanks for the kind words :)
@peerview
@peerview Жыл бұрын
wow! that's a great video, yeah give 30 videos please. Would be great one about video or media in general? how to persist it ( i know, probably that's 50 videos long too XD)
@seanallen
@seanallen Жыл бұрын
Haha, yeah. SwiftData is a huge topic that will continue to grow as Apple builds upon this initial version.
@kuldar
@kuldar Жыл бұрын
You have such a clear way of explaining concepts. Great work! Looking forward to the new course!
@seanallen
@seanallen Жыл бұрын
I appreciate the kind words, Kuldar!
@denisfok1699
@denisfok1699 Жыл бұрын
Thanks for the intro, that is extremely useful.
@seanallen
@seanallen Жыл бұрын
Glad it was helpful!
@TrueChessKnock
@TrueChessKnock Жыл бұрын
Man... your explanation is top notch! You know where to put accents! Very well done 👍
@seanallen
@seanallen Жыл бұрын
Thanks! Glad you like my teaching style.
@JeudryPeñaPeña
@JeudryPeñaPeña 7 ай бұрын
Best tutorial! ive saw many 8h tutorials, but this is the most simple and powerful
@parthpatel7461
@parthpatel7461 9 ай бұрын
Crystal clear explanation
@seanallen
@seanallen 9 ай бұрын
Glad you liked it!
@satoriappdev
@satoriappdev Жыл бұрын
Honestly, what a fantastic video. Clear helpful, and patient. Learned so much of the basics without diverting too much into wild syntax and hard to comprehend coding. Really great work on this video it's perfect!
@patgoo2
@patgoo2 Жыл бұрын
Great, that covers a lot of information with swiftData and looking forward to your next video.
@seanallen
@seanallen Жыл бұрын
Glad you liked it!
@allenwixted1992
@allenwixted1992 Жыл бұрын
Sean! Back working on an iOS app and this is exactly what I needed. Haven’t coded since we spoke probably like 5 years ago when ARKit first came out. Excited to put it to use
@seanallen
@seanallen Жыл бұрын
Hey Allen! Welcome back. 👋
@dcspilot77
@dcspilot77 2 ай бұрын
simple, clear, great explanation ... 👌
@Greg-du
@Greg-du 9 ай бұрын
absolutely clear in the essential. the best teacher ever 👍 regards from France
@chrisrudy1969
@chrisrudy1969 10 ай бұрын
Thanks for the video!
@seanallen
@seanallen 10 ай бұрын
Happy to help!
@JM_theBoss
@JM_theBoss 5 ай бұрын
finally a video that actually helped!
@chezchezchezchez
@chezchezchezchez Жыл бұрын
Omg. I asked, and I received!! Thanks, Sean!
@seanallen
@seanallen Жыл бұрын
Happy to help!
@ishool108
@ishool108 Жыл бұрын
Thanks for the video. Two questions: - How do you work with related one-to-one and one-to-many models? - How to bring the logic of working with storage into ViewModel?
@ArneGockeln
@ArneGockeln Жыл бұрын
Very helpful! Thanks for sharing it!
@seanallen
@seanallen Жыл бұрын
Happy to help!
@조용진-i6z
@조용진-i6z 6 ай бұрын
Thank you so helpful!!
@seanallen
@seanallen 6 ай бұрын
Happy to help :)
@RomanPurishy-z2z
@RomanPurishy-z2z Жыл бұрын
Good lesson. Thanks
@seanallen
@seanallen Жыл бұрын
Happy to help
@thetutorialdoctor
@thetutorialdoctor Жыл бұрын
To the point, not overdone, not underdone and concise and clear. Great tutorial. This has everything you need to know to get started working with SwiftUI and SwiftData with good explanations
@mkboy5596
@mkboy5596 Жыл бұрын
thank you bro clear and smooth 🥰
@seanallen
@seanallen Жыл бұрын
You're welcome!
@kavinda_dilshan_paramsoodi
@kavinda_dilshan_paramsoodi 25 күн бұрын
Freaking Awesome ❤
@elemento_artz
@elemento_artz 8 ай бұрын
Awesome. Can you show it using Previews instead of the Simulator? Thanks
@mattross9992
@mattross9992 Жыл бұрын
Do you have a video on how to use swift data and preload the database and the data?
@yousifkurdy4778
@yousifkurdy4778 Жыл бұрын
Exactly what i wanted!
@seanallen
@seanallen Жыл бұрын
Hope ya like it!
@ridholmes
@ridholmes Жыл бұрын
Thank you!
@vinidotco
@vinidotco Жыл бұрын
A+ content for sure, thanks Sean,
@seanallen
@seanallen Жыл бұрын
I appreciate that! Glad you liked it.
@paulyandnukhas
@paulyandnukhas Жыл бұрын
That was super useful thanks.
@seanallen
@seanallen Жыл бұрын
Glad to hear it!
@paulyandnukhas
@paulyandnukhas Жыл бұрын
Are you on Threads,@@seanallen ? I'd like to follow you. `
@Arcanegon
@Arcanegon Жыл бұрын
Hi Sean, I've been watching some videos on your channel, and your method of presentation is excellent and easy to follow, I'm completely new to iOS development and was wondering if you have a video or tutorial that has a complete beginners guide?
@kailasvilaskore
@kailasvilaskore 5 ай бұрын
Is there anyway to connect swiftdata to amplify datastore ? Any sample code to implement Datastore & DatastoreConfiguration for amplify datastore
@rtjh045h
@rtjh045h 4 ай бұрын
what about saving the container to a file to share with another user?
@MFSDO
@MFSDO 7 ай бұрын
Thank you so much! Idk if you already made this video, bc I couldn't find on the channel but, if you could make a video to help use swiftData with view models that would be awesome! Thanks again
@LebenWerden
@LebenWerden 7 ай бұрын
Hi, how I can use onMove modifier on expenses?
@anudeepananth
@anudeepananth Жыл бұрын
How do we perform CRUD outside the view, example periodically check for new data from the server, download it using background tasks but now it needs to be persisted to local database
@modhi210
@modhi210 Жыл бұрын
what did you mean by ExpenseCell ?
@ManojAP
@ManojAP Жыл бұрын
can you tell me how I connect sql based db to swift data.... video is useful. thank you
@bharned3
@bharned3 Жыл бұрын
Thanks I have been enjoying your videos. Is this one available to grab as a starter
@seanallen
@seanallen Жыл бұрын
I don't have starter projects, however you can grab the completed source code at seanallen.teachable.com/p/source-code-youtube-videos
@Bankai3474
@Bankai3474 Жыл бұрын
Great video, I've been working on an app with SwiftData since it was announced while doing the #100DaysOfSwiftUI challenge. You were wise to wait till now before making a video because there were some bugs when you had custom types and enums haha. Anyways, thanks for the example because now I can change my edit view, Apple's example app of updating an existing SwiftData object isn't like this so now I can clean up my code a bit.
@seanallen
@seanallen Жыл бұрын
I agree. This is definitely a great start for SwiftData, but it needs another year or two to mature.
@sreekanthzyou
@sreekanthzyou Жыл бұрын
want to create SwiftData in a Framework not in Host App. where do we specify the model container?
@MineRala-bn4ep
@MineRala-bn4ep 6 ай бұрын
hi @seanallen , How can I do the undo process in swift data. Am I getting an ID-related crash?
@ZTagger97
@ZTagger97 4 ай бұрын
whats the difference between Binding and Bindable,are they same usage different annotation?. Great video as always.
@andymorato7588
@andymorato7588 Жыл бұрын
Does anyone know if there is a way to query based on a State var? Say there is a button where the user can set the month with the intention of viewing every expense pertaining to just that month. I don't think we can just set the month as a state var and use it in the Query filter
@septimir5278
@septimir5278 Жыл бұрын
If @Query results change, will the view invalidate like with @State and re-render?
@seanallen
@seanallen Жыл бұрын
Yes, that's how it should work.
@dgeneration
@dgeneration Жыл бұрын
Can you make a video showing how to implement swiftdata outside of a view? I’d also like to see fetch descriptors explained if possible.
@Michael-Martell
@Michael-Martell 10 ай бұрын
Incredible video man! First time seeing anything from your channel! Been slamming my keyboard trying to get through UI mismatching and out of date CoreData tutorials. I would love to purchase a SwiftData course if you have one. Would you post on Udemy maybe?
@seanallen
@seanallen 10 ай бұрын
Glad you liked it! I don't have a Swift Data course (yet) because it's pretty new and I expect a lot of updates and changes with iOS 18 this year.
@DragonByte79
@DragonByte79 Жыл бұрын
Does anyone know if I have to care about unique constraints? Do I have to check if it exists before inserting it? Currently, it is working. It won't add another one. Is SwiftData handling it?
@torfeuzarre
@torfeuzarre Жыл бұрын
Thanks Sean. Great tutorial as usual 😊 As a beginner it looks far easier to begin than Core Data 😅
@seanallen
@seanallen Жыл бұрын
Yes... it's much easier. It needs another year or two to mature, but it's a great start and clearly the future.
@xtu373
@xtu373 Жыл бұрын
Please make some vidoes of data structures and algorithms in Swift
@seanallen
@seanallen Жыл бұрын
That's out of my area of expertise. I haven't interviewed for a job in a long time and that's the only time I ever used or studied that topic.
@piteke100
@piteke100 Жыл бұрын
Hi, I’m continuing to study SwiftData by repeating all the tutorials but I can’t understand one thing: I have to create an app with a default list (which therefore no data needs to be added) and this list is contained in a toggle. How do I make only the toggle state persistent?
@OttoFaerber
@OttoFaerber Жыл бұрын
What is with Dynamic Filter
@chesterman18g
@chesterman18g Жыл бұрын
Container-Context in SwiftData is really a mirror of an CoreData Persistent store and ManagedObjectContext with sugar of autosave (?).
@seanallen
@seanallen Жыл бұрын
Yup. That's it.
@D0iego
@D0iego Жыл бұрын
How can I use the context outside swiftUI? Like if I want to manage in a different class an Object stored in a context
@seanallen
@seanallen Жыл бұрын
In the video I show you how to create a container object. Once you have that object you can use it outside the view hierarchy (like a SwiftDataManage singleton for example).
@ondrejrohon5696
@ondrejrohon5696 Жыл бұрын
I did a bit of iOS development when Swift was brand new and it's incredible how far i went.. so much simpler nowadays. I was thinking about side project with nice offline functionality and I though about CoreData and how complex it is. This is such a good news to see there is beautiful new "SwiftUI" way how to do it. Thanks so much for this clear introduction! :)
@seanallen
@seanallen Жыл бұрын
Yes... this will be a huge improvement over Core Data.
@nitramluap
@nitramluap Жыл бұрын
I need to be able to migrate my CoreData app to SwiftData but it's just not there yet... CoreData is still WAY more sophisticated, particularly for large complex databases with lots of > relationships, etc. Fingers crossed they'll make it possible in the next year....
@seanallen
@seanallen Жыл бұрын
Agreed... give SwiftData another couple years. It's clearly the future, but not quite there yet for complex projects.
Жыл бұрын
Great content! Very useful but as everything that introduced newly, to use them daily, we need to wait until iOS 17 is used more.
@seanallen
@seanallen Жыл бұрын
Yes. And it's probably needs another year or two to be fully ready for complex projects.
@jacobwoods1032
@jacobwoods1032 Жыл бұрын
Could you make a video about becoming a freelance app dev?
@moamberraza7658
@moamberraza7658 Жыл бұрын
in case where you are handling with multi model how we are going to identify which is getting triggered in view. just a little confusion here as i am a basic learner.
@bharned3
@bharned3 11 ай бұрын
Anyone found a way to back up the data. Not sync it for multiple devices, but create a backup file of the data to iCloud or dropbox, then restore from that file if needed.
@Uz_Mobile_Developer
@Uz_Mobile_Developer Жыл бұрын
Thanks for video. I think IOS development very easy than Android development. This video was very helpful
@seanallen
@seanallen Жыл бұрын
Glad it helped!
@morgancooledge3557
@morgancooledge3557 Жыл бұрын
New to SwiftU here. Is it SwiftUI best practice to keep the .sheet views code inside the same view as the content view or better to have them in their separate views? So instead of 1 view you would have 3, if that makes sense.
@seanallen
@seanallen Жыл бұрын
I'm not sure I follow what you mean. Do you mean within the same file, or within the actual View?
@morgancooledge3557
@morgancooledge3557 Жыл бұрын
@@seanallen Sorry I think I meant file.
@josep-rudo
@josep-rudo 9 ай бұрын
Hi Sean! Thanks for your SwiftUI videos, for all of them. Are really helpful!,. Please, Can you share your Xcode theme? Thanks in advance 🫶🏻
@seanallen
@seanallen 9 ай бұрын
Happy to help. The theme is called Midnight. it's a default one in Xcode. The only thing I changed was the color of the comments. I made them grey.
@satoriappdev
@satoriappdev Жыл бұрын
Would you use this over Realm?
@seanallen
@seanallen Жыл бұрын
I've never used Realm before, so I can't give a valid opinion here.
@satoriappdev
@satoriappdev Жыл бұрын
okay, thanks!@@seanallen
@denisk3852
@denisk3852 Жыл бұрын
How about sharing data between an app and widgets?
@seanallen
@seanallen Жыл бұрын
Use an app group and put that ID in the container configuration parameter.
@smejia6362
@smejia6362 6 ай бұрын
short and super fast explanation. This guy was in a hurry to finish the video 🫣
@seanallen
@seanallen 5 ай бұрын
Some like short and to the point, some like long drawn out. I try to strike a balance.
@Mater-code
@Mater-code Жыл бұрын
can you talk about vision os?
@seanallen
@seanallen Жыл бұрын
I have an overview video here - kzbin.info/www/bejne/jF7QenyZq76lnpIsi=dpjgdJwFYlQQ2o65
@JeudryPeñaPeña
@JeudryPeñaPeña 7 ай бұрын
Suggestion: if u skip so much code video for ui, give the code to copy it, so we can do it fast too
@HarutoPlay
@HarutoPlay 10 ай бұрын
How can I save a dict?
@unthinkabilities
@unthinkabilities Жыл бұрын
Awesome video, SwiftData looks really good. The only thing I’m wondering is: What happens to an Expense when we assign it to the ExpenseToEdit variable and then dismiss the edit sheet? Does that Expense just keep sitting in the variable until we assign to it a different Expense (at which point I assume the sheet would trigger again)? Or does Swift automatically set the value to null again after we dismiss the sheet?
@seanallen
@seanallen Жыл бұрын
It will hold the value until we assign it a different one (at which point would trigger the sheet again with the new information)
@jellesu
@jellesu Жыл бұрын
Hi Sean, really informative video. Is there a way to get data from a network request and transform the json straight into a swiftdata model with Codable?
@seanallen
@seanallen Жыл бұрын
Yes... in SwiftData your models are the same models you would use in normal Swift code.
@johnpatrickechavez1216
@johnpatrickechavez1216 Жыл бұрын
is this only work in iOS 17?
@seanallen
@seanallen Жыл бұрын
Yes, this requires iOS 17 and above.
@joshuarileymagic
@joshuarileymagic Жыл бұрын
This really is amazing but it put me off using it atm because it's obviously only from iOS 17 & above, I'm using FMDB right now
@Notkdenben
@Notkdenben 7 ай бұрын
I never understand the do/try/catch blocks because all tutorials force unwrap or put in comments saying “// do some code here” lol
@Jem-xu2jm
@Jem-xu2jm Жыл бұрын
please my friend make tutorial based on new swiftdata and swift ui, like recent ones, 10 hours each
@seanallen
@seanallen Жыл бұрын
Oh, just a casual 10 hour tutorial??
@ayberkmogol
@ayberkmogol Жыл бұрын
@ioscaleb
@ioscaleb 2 ай бұрын
I appreciate your efforts here, but buddy, pick a lane. If you took out all the “I want to expose you to what’s possible” but on the other hand “that’s way out of scope for this video” excuses, this video would be 10 minutes shorter and a lot easier to follow. A really simple example is great for an introduction. Do that first, and *then* explain that most of what you showed can be customized and why that’s useful. Or do a second “deep dive” video based on an MVVM app that shows a more complex model with a custom container.
@memocappa5495
@memocappa5495 2 ай бұрын
💯
SwiftUI Drag and Drop with Transferable Custom Object
26:33
Sean Allen
Рет қаралды 25 М.
So Cute 🥰 who is better?
00:15
dednahype
Рет қаралды 19 МЛН
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
Why RISC-V Matters
13:42
ExplainingComputers
Рет қаралды 34 М.
Create your first app with SwiftUI and SwiftData
2:19:51
Paul Hudson
Рет қаралды 58 М.
Swift API Calls for Beginners (Networking) - Async Await & JSON
25:35
SwiftData Basics in 15 minutes
15:18
CodeWithChris
Рет қаралды 55 М.
Binding vs. Bindable in SwiftUI on iOS 17
13:12
donny wals
Рет қаралды 11 М.
Play: The Secret Weapon for iOS Devs & Designers
10:12
Sean Allen
Рет қаралды 40 М.
I Made an iOS App in MINUTES with This AI Tool!
13:20
Creator Magic
Рет қаралды 666 М.
Swift Closures Explained
14:23
Sean Allen
Рет қаралды 70 М.
Expert Advice to Learn iOS Dev & Swift FAST
1:04:52
Sean Allen
Рет қаралды 41 М.
How to Build Effective AI Agents (without the hype)
24:27
Dave Ebbelaar
Рет қаралды 122 М.