Donny Wals: Using Core Data in a Modern SwiftUI Application

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

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!
@amdizle28
@amdizle28 Рік тому
Donny killed it, great presentation great info and seasoned tech understanding
@soilb0y
@soilb0y 2 роки тому
Thanks. Perhaps I won’t be abstracting core data away just yet. I’m going to go with the flow! Thanks
@w0mblemania
@w0mblemania Рік тому
This was very useful. Thank you!
@0xjorgev
@0xjorgev 2 роки тому
Great talk Donny!
@tamasterjek7520
@tamasterjek7520 2 роки тому
Thank you for the multi context solution. I was looking for this for a while...
@treboc2942
@treboc2942 2 роки тому
Thank you for your time to upload such great content and provide it for us for free. Awesome!
@happy__amoeba
@happy__amoeba 2 роки тому
Excellent video
@jasperdunn
@jasperdunn 2 роки тому
Thanks Donny!
@ushadesai6306
@ushadesai6306 2 роки тому
Is the topic 'passing NSManagedObject to childViewContext' part of Practical Core Data book ?
@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.
@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 4 місяці тому
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... :)
@PawelPalczynski-VideoDayTM
@PawelPalczynski-VideoDayTM 2 роки тому
Is Core Data is ❤️ and CloudKit 💪
@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.
How to use Core Data with MVVM Architecture in SwiftUI | Continued Learning #15
29:55
Intro to SwiftData - Model, Container, Fetch, Create, Update & Delete
27:13
Китайка и Хеликоптер😂😆
00:18
KITAYKA
Переглядів 737 тис.
БРАВЛЕРЫ ОТОМСТИЛИ МАТЕРИ😬#shorts
00:26
INNA SERG
Переглядів 4,2 млн
ВИРУСНЫЕ ВИДЕО / Мусорка 😂
00:34
Светлый Voiceover
Переглядів 3,2 млн
iOS Core Data QuickStart Tutorial 2020
1:10:58
CodeWithChris
Переглядів 97 тис.
Swift API Calls for Beginners (Networking) - Async Await & JSON
25:35
The Story of Next.js
12:13
uidotdev
Переглядів 526 тис.
SwiftUI - Intro to MVVM | Example Refactor | Model View ViewModel
11:55
How to use Core Data with @FetchRequest in SwiftUI | Continued Learning #14
36:34
What Is an AI Anyway? | Mustafa Suleyman | TED
22:02
TED
Переглядів 276 тис.
Core Data In SwiftUI | SwiftUI Core Data Tutorial
2:29:44
tundsdev
Переглядів 20 тис.
Vortex Cannon vs Drone
20:44
Mark Rober
Переглядів 10 млн
Почему iPhone ярче? #apple #iphone
0:46
Не шарю!
Переглядів 400 тис.
Самая редкая видеокарта от SONY
13:51
Nitroxsenys
Переглядів 49 тис.
Сомнительно... Ну Окэй... Распаковал Nothing Phone (2a)
16:19
РасПаковка ДваПаковка
Переглядів 47 тис.