Easily Add Filtering In SwiftData Using Searchable 🕵🏾‍♂️ | Filter in SwiftData | #3

preview_player
Показать описание

Easily Add Filtering In SwiftData Using Searchable 🕵🏾‍♂️ | Filter in SwiftData

Build A To-Do List App using SwiftData (Swift Data Tutorials)

**********************************

*Timestamps:*

00:00 - Intro
00:17 - How To Add A Searchbar In SwiftUI
01:18 - How To Filter Data In SwiftData
06:53 - How To Filter On Multiple Properties In SwiftData
09:44 - Handling empty states in SwiftData

**********************************

So, how do you filter data in SwiftData using SwiftUI? Well, it's actually quite simple. In this SwiftData Tutorial. We'll be taking a look at how to filter data in SwiftData using the searchable modifier in SwiftUI.

We'll be filtering out our to-do items' title and category names to display the relevant to-do items to the user.

**********************************

*Check Out My Courses 👨🏽‍🏫*

Enjoy my teaching style? Check out my other courses on my website that may interest you, they range from beginner to advanced topics within iOS development.

*Link to Website*

**********************************

*Join the crew 🤝*

Want to help support the channel? Become a member with the join link below and get access to exclusive badges and stickers, as well as other perks that are coming soon.

*Become a channel member*

*Support in other ways 💕*

You can support me for free and help the channel grow so that I can continue to make the best iOS development content for you by liking, commenting, subscribing, and hitting the notification bell.

All of this really helps my channel grow and allows me to keep on making content for you. If you’re interested in subscribing to the channel then you can do so with the link below.

*Subscribe to the tundsdev YouTube channel*

**********************************

*Download Source Code*

Interested in looking at the source code? Then check out the GitHub Repo below

**********************************

EditorKeys
View Editor Keys Amazing Products with the link below and use the discount code for 10% off any product

Get a 10% Discount Code on any product with the code below
TUNDSDEV

See my keyboard cover in action with my review below 👇🏾

**********************************

RØDE Wireless Mic

RØDE SmartLavPlus Microphone

2021 Apple MacBook Pro (16-inch, Apple M1 Pro chip with 10‑core CPU and 16‑core GPU, 16GB RAM, 1TB SSD) - Space Grey

Apple Magic Keyboard with Numeric Keypad (Wireless, Rechargeable) 

Apple Magic Mouse

Secretlab TITAN 2020 Charcoal Blue Gaming Chair

ErgoFoam Ergonomic Foot Rest for Under Desk

Lumbar Support Pillow

Macbook Stand for Apple Macbook and All Notebooks

Portable Chair Green Screen Background

**********************************

#iosdev #iosdevelopment #swift #swiftlanguage #xcode #appdevelopment #mobileappdevelopment #iosappdevelopment #appdeveloper #iosprogramming #iosengineer #appdevelopmenttips #iosdevelopmenttips #swiftui
Рекомендации по теме
Комментарии
Автор

Watched a few tutorials before I found this one. None of them clicked until this! Thank you, my friend!

samuelhcohen
Автор

You're my absolute favorite YouTuber !!! I'm learning so much watching your videos, and I'm very close to launch my first app; and not just that but you're fun to watch!!! Thank you!!!

silcalderale
Автор

thank-you. I've been working on this problem for weeks, I was trying to use - init(sort: - but that was getting me no where. this solution seems too easy and works great

DugRutBV
Автор

You came in clutch many times ever since i started making my app a few weeks ago. Always had a video for whatever frustrating roadblock i was in. Really appreciate you sharing what you learned with everyone else, I could not fathom having to spend hours figuring this out on my own just by reading documentation. Thanks.

andres
Автор

I am extremely enjoying your this series. Great Job. I learned some cool stuff.

nileshjdarji
Автор

very good video, well explained and worked perfectly for my application... keep up the great work!

LG-veus
Автор

This is a great one! How would you go about hiding the search bar when there are no To-Dos yet? Since the .searchable modifier does not directly support conditional application, would you recommend going with a conditional view structure?

dmacharo
Автор

Fantastic video you made and great ways to have a searching bar . I have a question: if I accidentally delete the item, how do I restore it, or how do I make a query that filters all deleted items and show them on a view where i can restore the items that i want to ?

pgong
Автор

LOVE your videos!! Can you filter on the Date?? I can not seem to right code for the comparable to give me all items due on one date.

JenniferHolub-gx
Автор

Thanks so much for this series! It's really helpful!
Just one thing, between video parts, I'm noticing some continuity issues. For example, at 1:12 I see there's code for .sheet, but I don't have that at all. I double-checked the Github repo and that also has what I have. Where did this new code come from? I've been following each video part very closely and did not see any modification to this part of the code in a prior part. Can you please explain or perhaps point to an updated Github repo? Thanks!

mr_shift
Автор

We’re going places alright thanks to you 🙏 😂 just another great video ❤

Suggestion: vid no.4 Sync the app with iCloud 😬 no pressure. I don’t need it but it’s just a suggestion. 👋

sxmiotb
Автор

Thanks for the vids man! How would we be able to fetch only items that match today's date?

nylelevi
Автор

If I have two LIST on a single View: how can I get the .searchable to work separately for both?

DugRutBV
Автор

This works for one query on the dataset creating the List but how would filteredItems work when you section the list for Active and Completed items? I ended up in a continuous loop. I'm thinking a List to replace the the display of the two sections when searchquery is not empty and a list with the two sections showing when searchQuery is empty.

kenturnbull
Автор

Could you do a tutorial of download data from a REST API and saving that data into SwiftData?

vanylaskywalker
Автор

Just noticed that my filteredItems is returning ONLY Items and not Categories as well. Could it be the definition? Too Quick on the comment didn't watch long enough...sorry.

kenturnbull
Автор

I was wondering why the list was getting redrawn each time a simple computed property was changing, but it is because searchQuery is declared with @State

markaurelius
Автор

Firstly, thank for this!
Secondly, are you sure this is the right way we should be filtering?
As far as I can see -- and feel free to correct -- we are still fetching 100% of the database.
And then, we're filtering those (possibly thousands) of entries.
If you have, say a diary app, that's going to be a big DB hit after years of use.
It seems to me that we need to be filtering at the query level, with a predicate.
Regards.

wmblemania
Автор

Value of type '[IngredientItem]' has no member 'Name'

why am i getting this error?

gdrcht
Автор

Really good videos buddy! How much do you make on this channel if you don't mind me asking? Is it upwards of $50, 000 per year?

paypal