Discover How To Save Your API Response Into SwiftData ☁️ | SwiftData Tutorial | #7

  Рет қаралды 6,118

tundsdev

tundsdev

Күн бұрын

Пікірлер: 42
@tundsdev
@tundsdev Жыл бұрын
🚨Xcode Update🚨 Starting from Xcode 15 Beta 5, when sorting items you now need to include the root in the keypath too, so update the sort parameter to look like this. @Query(sort: \Photo.id) private var photos: [Photo]
@ConnorH713
@ConnorH713 9 ай бұрын
Love your videos dude! They're super informative and entertaining
@tundsdev
@tundsdev 9 ай бұрын
Glad you like them!
@kyle-roche
@kyle-roche 10 ай бұрын
Thanks. Like the channel! How are you handling updates back to the server. Example would be delete a record on the phone… where are you sending the delete call back to server?
@nickpatel1663
@nickpatel1663 Жыл бұрын
thank you tunds for the awesome video! Really enjoyed! I wish to become a top youtube in the iOS community. please keep it up!
@tundsdev
@tundsdev Жыл бұрын
Glad you enjoyed it 👌🏾
@oldschool84
@oldschool84 4 ай бұрын
You asked us to write in the comments what content we would like to see. Well, here is something related to this topic. Can you explain how to fetch and save the data that we would download from an API through the Apollo client. Also, make a tutorial on how to import GraphQL and fetch data through it. Thank you
@Lvoonok
@Lvoonok 7 ай бұрын
Maaaaaaannnnn….. Thank you so very much for all your hard work and videos! The way you show live use tricks and technics are extremely useful. Love your teaching style (big fan!!!). I don’t usually leave comments anywhere. But YOU Sir, are AMAZING. Once again, thank you! Please keep making more tutorials, to many it might seem trivial, but YOU ARE CHANGING SOMEONES LIVE 🙏🙏🙏 P.s. Baki vs Pickles was crazy
@tundsdev
@tundsdev 7 ай бұрын
I appreciate that!
@SiamakAshrafi
@SiamakAshrafi Жыл бұрын
Oh ... nice! Thanks for the tutorial
@tundsdev
@tundsdev Жыл бұрын
Glad you found it useful 👌🏾
@t.o.n.i.o
@t.o.n.i.o Жыл бұрын
Great video, thanks a lot!
@dimaobertinskiy
@dimaobertinskiy Жыл бұрын
Hi. Thanks for your videos. Why did you convert lastFetchedTime interval to a date instead of comparing it to the now time interval ?
@tundsdev
@tundsdev Жыл бұрын
Hi, Glad you enjoyed it. The reason why i use a time interval for the appstorage is that appstorage in SwiftUI doesn't support saving a Date yet as far as i'm aware of. So it convert it into a time interval representation. Then back to a date so that i can use the calendar to compare if it's been a certain number of seconds. I wouldn't want to compare two time intervals and it's just clearer for me to visualise too. Hope this answers your question.
@chukwumaugonabo1045
@chukwumaugonabo1045 5 ай бұрын
Great Stuff!
@adamcm82
@adamcm82 Жыл бұрын
Thank you! I’ve watched all your SwiftData videos. Any idea how to share data with other users? There’s zero documentation on that…
@tundsdev
@tundsdev Жыл бұрын
Hey hope you enjoy them & can you explain on sharing data with an example pls?
@adamcm82
@adamcm82 Жыл бұрын
@@tundsdev Yes, we definitely enjoy all your videos! So, CloudKit easily allows us to persist swiftdata and sync it with all our devices. But, what if I’m creating a Reminders App and want to share a list with you, like the actual Apple Reminders App allows? Not a copy, but a live joint list that we can update together. CloudKit supports a public, private, and shared database. And what’s the point in persisting data if you can’t share it with anyone :( It seems like all of Apple’s native apps allow for this: photostreams, shared notes, shared reminders, shared calendars, shared locations, shared AirTags, shared safari tabs, etc. Whether we’re creating a todo list, a recipe app, or even a game, sharing data is pretty essential. Thank you!!!!
@kenturnbull9679
@kenturnbull9679 4 ай бұрын
Try a little Old Bay on your Chip buttie. You don't know what you're missing
@mattross9992
@mattross9992 11 ай бұрын
Hey Tundsdev, It erased my earlier comment lol. Anyway shorter version is I am looking at either doing. this approach or trying to preload it via JSON file or making the data in another app and dropping it in. It is a LOT of dates not sure which way to. go. I got it working so. far but when I tried adding the encoding in manually to make it a swift data class. I am just getting errors.
@ChadShryock
@ChadShryock Жыл бұрын
Do you have an example with relationships and caching data into SwiftData?
@tundsdev
@tundsdev Жыл бұрын
👋🏾 This is part of a free course here on KZbin, You could tweak it to use the techniques in this video How To Preload Relationships Into SwiftData ModelContainer ⚡️ | SwiftData Tutorial kzbin.info/www/bejne/ep-9fKqihNCFqKc Full Course kzbin.info/aero/PLvUWi5tdh92wZ5_iDMcBpenwTgFNan9T7&si=zVzmrqDz4MnwTLfR
@thomasfahlke4253
@thomasfahlke4253 Жыл бұрын
Thanks tunde. Great job. But how can I save Images in Swiftdata synced with iCloud?
@tundsdev
@tundsdev Жыл бұрын
Thanks & saving an image is coming next up 👀 the iCloud stuff, i’ve not decided yet 😅
@boyonetouch7407
@boyonetouch7407 Жыл бұрын
You can explain about code in line function clear photo _ = try or dosomething What’s useful or when need use that syntax
@tundsdev
@tundsdev Жыл бұрын
The underscore is just a placeholder, the function returns a bool but i don’t want to store it in a variable so I use the underscore as a placeholder
@boyonetouch7407
@boyonetouch7407 Жыл бұрын
@@tundsdev thank you
@vanylaskywalker
@vanylaskywalker Жыл бұрын
Are you suggesting we should use codable class model instead of codable struct for json decoding of APIs in real projects, or is this done just for simplicity for this video and it's not something recommended in a real project?
@tundsdev
@tundsdev Жыл бұрын
Hey, i’d start off with codable imo. You could use this in a real project too. The only time i would use a mapper is if your model changes at lot or if your API response it really big i.e. it has a lot of properties then you could use a mapper to keep the model small and only use the properties you need 👌🏾
@vanylaskywalker
@vanylaskywalker Жыл бұрын
@@tundsdev Did you mean to say "i'd start off with codable class"? I am currently doing mapping in my project and I find it makes it much more complex. Your reasoning makes sense.
@tundsdev
@tundsdev Жыл бұрын
Yes start off with codable, it’s better to start simple and then scale if you need too into something more complex.
@vanylaskywalker
@vanylaskywalker Жыл бұрын
@@tundsdev Hi again, I just realized you might have misunderstood my question. My question was more about if we should use "class" (Swiftdata @Model) or "struct" to decode the API response.
@tundsdev
@tundsdev Жыл бұрын
@vanylaskywalker Hi, you can’t use struct with the model macro you need to use a class. So by default they would be classes
@gmjelle
@gmjelle Жыл бұрын
Awsome video! Do you think they'll fix the Codable error by the time xcode gets out of Beta?
@tundsdev
@tundsdev Жыл бұрын
I actually don’t know if its an error or if it’ll be fixed 😅 It may be there by design 😬 Glad you enjoyed the video
@kiohaha
@kiohaha 10 ай бұрын
have you anything on swift data from api in a swift package lol
How To Use SwiftData with Preview | SwiftData Tutorial | #10
26:16
This Game Is Wild...
00:19
MrBeast
Рет қаралды 193 МЛН
Yay😃 Let's make a Cute Handbag for me 👜 #diycrafts #shorts
00:33
LearnToon - Learn & Play
Рет қаралды 117 МЛН
Кто круче, как думаешь?
00:44
МЯТНАЯ ФАНТА
Рет қаралды 6 МЛН
1. SwiftData CRUD Operations
42:40
Stewart Lynch
Рет қаралды 31 М.
Mocks (Mocking), Stubs, and Fakes in Software Testing
5:48
CodeConnect AI: Age of Intelligence
Рет қаралды 684
SwiftData Basics in 15 minutes
15:18
CodeWithChris
Рет қаралды 51 М.
SwiftData Migrations | SwiftData Tutorial | #11
32:24
tundsdev
Рет қаралды 4,8 М.