iOS 15: Dynamically filtering @FetchRequest with SwiftUI - Core Data SwiftUI Tutorial 6/7

  Рет қаралды 10,439

Paul Hudson

Paul Hudson

Күн бұрын

Пікірлер: 37
@Wiintb
@Wiintb Жыл бұрын
5839 views and only 165 likes? Man, I am blown by this tutorial and I can never understand user behaviour. All I can say is a BIG THANK YOU.
@AvantjerTube
@AvantjerTube Жыл бұрын
It may be that some viewers found this video to be overly, (unnecessarily?), complex. I, for one, will not be "liking" it because I'm still glazed over from all the "helpfulness". Maybe some of us would prefer a "for dummies" version. 🤓
@Yannemal
@Yannemal Жыл бұрын
this completely went over my head the first time I attempted it. Rewatching it and resisting the urge to go straight for the shiny new SwiftData
@kslazinski
@kslazinski 2 жыл бұрын
Thank you for this and every other video, Paul. It’s very cool how you show practical examples of how things work. Easy to learn and implement in other apps. Thanks for the work you’re doing to help other people learn how to code
@lapusan2008
@lapusan2008 2 жыл бұрын
OMG! you’ve saved my ass. I’ve been trying endlessly for a solution until I’ve watched this video. Thank you!!
@Pedro76mchlkg
@Pedro76mchlkg 3 жыл бұрын
I can’t thank you enough. You have the gift to make everything easier to understand. BTW, I would love to see a tutorial about core data in MVVM, or an explanation about why I should or should not separate core data from the view. Thank you so much for your tutorials!
@a.h.m1365
@a.h.m1365 3 жыл бұрын
as I Think Paul not a big fan of mvvm with swiftui
@DavidNitzscheBell
@DavidNitzscheBell 2 жыл бұрын
@@a.h.m1365 why do you think that? I've seen nothing to support that.
@Y0sid0
@Y0sid0 2 ай бұрын
Great explanatiom - structured and detailed You rock!
@AvantjerTube
@AvantjerTube Жыл бұрын
Yikes! Such a long distance to have to go for something seemingly simple. (I'm Discouraged 😟) ...but I'm very impressed by **your** cleverness. 🤓 Disclaimer: I'm a total newbie to Core Data in SwiftUI. Newb Question: Is there a reason you wouldn't create a fetch request inside the .xcdatamodeld file ? Thanks
@VykingBoy
@VykingBoy 8 ай бұрын
I used this approach to change the predicate in the init() for a fetch of Annotations on a Map in MapKit. Works fine but if I change a property on any of the fetched results objects then it removes the Object from the fetched results resulting in that Annotation disappearing from the map !
@lincolndickerson1293
@lincolndickerson1293 2 жыл бұрын
I am so glad I stuck around. The second half of this lesson is worth my weight in Mithril (Sorry you said Lord of the Rings) . This is the best explanation of generics I have seen and by attaching to the CoreData fetch it over the top. Curious why you don't use #keyPath(Singer.lastName) Also I tend to level the leave Codegen as Class Definition and simply use extension in a separate file like this list for computed properties extension Singer { public var unwrappedLastName: String { lastName ?? "unknown" } } In doing so I feel it is easy in that I never have to regenerate the Entity manually
@nitesh-maharaj
@nitesh-maharaj 3 жыл бұрын
I do like the generic solution, although one change I'd make to add a bit more flexibility to this is pass in an NSPredicate to the initializer. So if for example the caller wants to filter on first or last name, then they could just change their predicate and aren't bound to the functionality of the black-boxed view. Thanks Paul.
@DavidNitzscheBell
@DavidNitzscheBell 2 жыл бұрын
I agree with you, sort of. This video shows precisely what you describe, being able to filter on first or last name. But, it doesn't allow for filters that are not "BEGINWITH". So, yes, it would be nice to have the predicate be a parameter. We should try it out. Also, I need to figure out how to allow the filter to also sort, dynamically.
@nitesh-maharaj
@nitesh-maharaj 2 жыл бұрын
@@DavidNitzscheBell To filter dynamically, the @FetchRequest should be in a sub view.
@Corban_Dallas
@Corban_Dallas 3 жыл бұрын
Very thanks! But I think making manual codegen for Singer class is a little excessive. We can just create extension for Singer class to add two value wrappers. It will be little simpler to do and look cleaner.
@DavidNitzscheBell
@DavidNitzscheBell 2 жыл бұрын
can you create an extension for Singer class if the Singer class is not created in code? Hmmmmmm. (testing...) Oh, wow! Yes, it seems you *can* create an extension. Clever!
@DavidNitzscheBell
@DavidNitzscheBell 2 жыл бұрын
oooooh, this looks really good. I definitely need it.....
@OttoSchmilinsky
@OttoSchmilinsky 2 жыл бұрын
Why does everyone write all the code inside the ContentView? Nobody makes subviews in other files, and I only found one that did the views but did not create the previews to see them on canvas. can you recommend me a book of complete MVVM examples? Thanks in advance.
@blinkpo4
@blinkpo4 2 жыл бұрын
Hi! Have you been able to find any useful books? I have the same problem. Applying MVVM with Core Data, FetchRequest and SwiftUI is a nightmare. Thanks in advance.
@mikehimself909
@mikehimself909 2 жыл бұрын
I found Paul’s video very helpful: kzbin.info/www/bejne/oZfWcmttprd2abs
@javed2547
@javed2547 2 жыл бұрын
Is there any thread safety issues with passing the actual NSManagedObjects around?
@srome0711
@srome0711 11 ай бұрын
What is the data store changes though?
@bbulliard
@bbulliard 2 жыл бұрын
Well done. Very, very nice! Thank you!
@willianvicentini1135
@willianvicentini1135 Жыл бұрын
Muito bom o video, uma duvida como faria para processar o resultado e totalizar algum campo de valor...
@lawho4189
@lawho4189 2 жыл бұрын
Great tutorial !!! help me a lot, may I ask how to count the total number of item after filtered ??
@Moxific
@Moxific 2 жыл бұрын
What if we'd like to filter with two or more filter keys ?
@GenZRadio234
@GenZRadio234 2 жыл бұрын
_ means your writing to the setter property. Also why not just set the .nspredicate property on your results if you want dynamic filtering🤔. Either way 🙌
@kiohaha
@kiohaha 2 жыл бұрын
omg its so hard to get the searchbar added to the list with this method. any ideas??
@MoAdel92
@MoAdel92 2 жыл бұрын
I think swiftUI team is making this topic a little bit complicated I think the word a or s should be @state variable And then we can change it and the results show update on spot Excuse me i am a beginner with swiftUI But this what i thought 💭
@etronik3339
@etronik3339 Жыл бұрын
Wow 🤩
@Eronx
@Eronx 2 жыл бұрын
Hi, Is someone here to explain me why we used _fetchRequest and not just regular one?
@DavidNitzscheBell
@DavidNitzscheBell 2 жыл бұрын
Paul explained it in the video. It's very technical and tricky, but he explained it...
@yhmlco
@yhmlco 2 жыл бұрын
Enjoying your videos but you're overcomplicating this one. Just reach into the fetchRequest from button or action handler and change the nsPredicate or nsSortDescriptors. View will automatically refetch.
@mamazur
@mamazur 2 жыл бұрын
Hi Paul. Thanks for the amazing tutorial. I have one error
@hoagy_ytfc
@hoagy_ytfc 3 жыл бұрын
Great tutorial, but sadly dog-free this time! :)
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 154 МЛН
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 3,6 МЛН
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 9 МЛН
SwiftData Basics in 15 minutes
15:18
CodeWithChris
Рет қаралды 51 М.
Vim Tips I Wish I Knew Earlier
23:00
Sebastian Daschner
Рет қаралды 79 М.
Наклейка SSD 💽
0:24
serg1us
Рет қаралды 571 М.
💁‍♂️Зачем infinix это сделала?🤦‍♂️
0:42
Не шарю!
Рет қаралды 1,3 МЛН
Что делать если разрядился iPad
0:53
Mikha Zen
Рет қаралды 117 М.
Introducing the "VitaWear SmartBand," a next-generation wearable gadget🎉
0:16
Vrashika Rajput Official
Рет қаралды 22 МЛН
Анимация логотипа для компании MYCOM
0:46
FreelStep Shorts
Рет қаралды 1,3 МЛН
👍🏻 Samsung Galaxy A56 - ЕГО ЗАХОТЯТ ВСЕ! Xiaomi так не сможет…
12:05
Thebox - о технике и гаджетах
Рет қаралды 242 М.