Donny Wals: Using Core Data in a Modern SwiftUI Application

  Переглядів 13,247

Swift Heroes

Swift Heroes

2 роки тому

Presented at Swift Heroes 2021
USING CORE DATA IN A MODERN SWIFTUI APPLICATION
Donny Wals, iOS Engineer, Disney Streaming Services
Learn how you can make good use of Core Data in a SwiftUI application. This talk will go over the basics of setting up a Core Data stack in a SwiftUI app, fetching data with and without @FetchRequest, and you'll learn how you can bind a managed object to a form using a child managed object context.
Attendees will learn all the important basics of using Core Data in a modern application.
#SwiftHeroes #SwiftConnected
swiftheroes.com/
/ swiftheroes_it
/ swift-heroes

КОМЕНТАРІ: 17
@yevhen_san
@yevhen_san 8 місяців тому
Finally I mange to fix my previews with Core Data. Thank you for sharing!
@ricifaviero
@ricifaviero 2 роки тому
I’m a complete beginner, but watch the whole video and subscribed to channel, so I can come back whenever I lean more!
@treboc2942
@treboc2942 2 роки тому
Thank you for your time to upload such great content and provide it for us for free. Awesome!
@tamasterjek7520
@tamasterjek7520 2 роки тому
Thank you for the multi context solution. I was looking for this for a while...
@amdizle28
@amdizle28 Рік тому
Donny killed it, great presentation great info and seasoned tech understanding
@w0mblemania
@w0mblemania Рік тому
This was very useful. Thank you!
@0xjorgev
@0xjorgev 2 роки тому
Great talk Donny!
@happy__amoeba
@happy__amoeba 2 роки тому
Excellent video
@jasperdunn
@jasperdunn 2 роки тому
Thanks Donny!
@soilb0y
@soilb0y 2 роки тому
Thanks. Perhaps I won’t be abstracting core data away just yet. I’m going to go with the flow! Thanks
2 роки тому
Is Core Data is ❤️ and CloudKit 💪
@mhfs61
@mhfs61 2 роки тому
Thank you Donny. Very clear and thoughtful presentation. I like your emphasis on not fighting the framework. The child context concept is quite helpful. I implemented a solution to use one view for both creating and updating, but that alway felt like dirty hack with too many lines of code. My refactoring starts straight away.
@ushadesai6306
@ushadesai6306 2 роки тому
Is the topic 'passing NSManagedObject to childViewContext' part of Practical Core Data book ?
@notorioustofu3482
@notorioustofu3482 2 роки тому
Tried implementing this a few different ways in a ListView -> DetailView case and always hit the same wall. While the child context does work as a scratch pad in the view model, and saves changes on calling persist, I can't seem to get those changes to trigger a refresh on the initial ListView. Unit tests confirm it's working and relaunch the app shows the change. Any ideas?
@dannybehar7148
@dannybehar7148 5 місяців тому
I'm running into the same issue. One thing that seems to work is to turn the ViewModel into an ObservableObject and then adding objectWillChange.send() on any code within the viewModel that changes the coreData model. This doesn't take advantage of the NSManagedObjects being observable though so hopefully there is a more straightforward path that we are missing... :)
@indiekiduk
@indiekiduk Рік тому
Too many SwiftUI mistakes in the code examples. 25:57 Although EditViewModel is a struct, inside its init it inits a context object which we must not do in body. Instead, the child context should be created in an action. 28:42 should be @Binding not @State. Although to be honest view models in SwiftUI is unnecessary, the View structs are actually the model for the UIViews on screen and the property wrappers give them object semantics. Usually we call @State structs that group vars simple Configs, e.g. EditConfig
@yhmlco
@yhmlco Рік тому
Disagree here. For the childViewContext to work it we need to keep a reference to it somewhere, and in this case a ViewModel is a better choice as it can be thunked into a StateObject and only instantiated when needed.
iOS Core Data QuickStart Tutorial 2020
1:10:58
CodeWithChris
Переглядів 97 тис.
Voloshyn - ЗУСИЛЛЯ (прем'єра треку 2024)
06:17
VOLOSHYN
Переглядів 638 тис.
Excited Dog Zooms In and Out of Sliding Door!
00:18
The Pet Collective
Переглядів 9 млн
How to use Core Data with @FetchRequest in SwiftUI | Continued Learning #14
36:34
Swift API Calls for Beginners (Networking) - Async Await & JSON
25:35
Data Flow in a SwiftUI App
33:15
CodeWithChris
Переглядів 51 тис.
STOP Using MVVM with SwiftUI
18:30
azamsharp
Переглядів 16 тис.
SwiftConf 2023 - Paul Hudson: Level up your SwiftUI
43:16
SwiftConf
Переглядів 8 тис.
The Story of Next.js
12:13
uidotdev
Переглядів 528 тис.
Core Data One-To-Many SwiftUI
20:54
Swift Arcade
Переглядів 6 тис.
Лучший Смартфон До 149 Баксов!!!??? itel s24
20:25
РасПаковка ДваПаковка
Переглядів 47 тис.
Какой телефон лучше всего снимает? 🤯
0:42
Радиоприемник из фольги, стаканчика и светодиода с батарейкой?
1:00
🤯Самая КРУТАЯ Функция #shorts
0:58
YOLODROID
Переглядів 2,9 млн