Thank you 🙌 do you have any videos on how to query it not on the main thread like you mentioned at the end?
@rafaelplinio65279 ай бұрын
Nice video as always and yes... tutorial about Profile in Instruments!
@tundsdev9 ай бұрын
You got it!
@SkoroVideo9 ай бұрын
Awesome video, thanks! YES! I'd really love to see a tutorial about instruments
@tundsdev9 ай бұрын
You got it!
@chezchezchezchez9 ай бұрын
Yes! A video 2:50 with that tool with be great.
@tundsdev9 ай бұрын
I got you!!!
@spaceman2000-i3s3 ай бұрын
Excellent video on ModelActor macro. It was very helpful.
@tundsdev3 ай бұрын
Glad it was helpful!
@chezchezchezchez9 ай бұрын
Can you expand on the "Write a predicate to fetch data" (to avoid the @Query on the main thread) My app uses a LOT of @Querys and the main thread is bogged down! I need more speed. Thanks!
@tundsdev9 ай бұрын
So you can use something like this www.hackingwithswift.com/quick-start/swiftdata/how-to-create-a-custom-fetchdescriptor The only downside is that you'd have to manage refreshing the view yourself etc which the query macro does for you automatically.
@chezchezchezchez9 ай бұрын
@@tundsdev so what do you recommend? I’m only a part-time Programmer/hobbyist. I would prefer something simplistic.
@sergiovinhal59343 ай бұрын
Helpful. Thank you sir !
@jayelevy9 ай бұрын
great video, as always. +1 on a video on instruments!! I have a swift data project that is really bogging down when initiating a view that includes a dynamic filter predicate. I have no idea how to troubleshoot. thanks for what you do
@tundsdev9 ай бұрын
Sounds great!
@silky0009 ай бұрын
Yes instruments tutorial!
@tundsdev9 ай бұрын
Got it!
@AdelUI4 ай бұрын
Thanx for amazing video, but is it working also when i want to update data ?
@ammarahmad90046 ай бұрын
When you set "Strict Concurrency Check" to "Complete", you will get a warning the message "Non-sendable type returned by call to actor-isolated function cannot cross actor boundary", How can void this.
@tundsdev6 ай бұрын
You need to make your model sendable manually by marking it with the @unchecked Sendable pretty good article explaining it here but it's safe to use this since we don't modify the model across different threads.Here's a simple example below. @Model class MyModel: @unchecked Sendable { }
@ammarahmad90046 ай бұрын
@@tundsdev Thanks for the explanation.
@spaceman2000-i3s3 ай бұрын
You can fetch using the ModelActor and then stuff a struct with the results and pass that as the struct is Sendable.
@stevethewindsurfer89113 ай бұрын
Why create an actor who you just reap everything into Task{let modelContext = ModelContext(container) ...} ?
@tundsdev3 ай бұрын
You have to use an actor so you can move it off the main thread and isolate it onto it's own thread which is what I explain in the video around 4:20, the ModelActor property wrapper lets you create a context away for the main one
@stevethewindsurfer89113 ай бұрын
@@tundsdev Hmm. In my test this also does move the operation to a background thread. I haven't done much with actors yet, so maybe actors are the preferred way to do it anyway. Here is the code the way I mean it: Task(priority: .background) { let newModelContext = ModelContext(TestApp.sharedModelContainer) (0...1000).forEach { index in let newItem = TestItem(uuid: UUID()) newModelContext.insert(newItem) } try? newModelContext.save() }