|
Hello everyone, I go through the lessons without using a storyboard, sometimes I have difficulties because the code is different from what the teacher does. I ran into a problem, my filter in textField does not work, although I found the answer to the problem here on the forum. Can anyone help me solve the problem? There are no errors, but the filter does not work. SceneDelegate:
MainViewController:
MainTabBarController:
PetitionModel:
|
|
I'm not sure if this is your problem, but when you are typing in a filter, and checking to see that it matches the title of a petition, it doesn't look like you are checking for case sensitivity. So, when you try to test the filter, are you making sure to type all the capital letters exactly as they appear in the petition title? If that is your problem, you will probably need to just make sure that you use ".lowercased()" on both the petition title and the filter answer before comparing them in your code. |
|
@Fly0strich I tried to write in different ways and with a capital letter and with a small one and all large and all small, nothing works ( |
|
Oh wait, maybe this is why yours isn't working. So, you have this function that runs when a person types in a filter...
It adds all the necessary petitions to the But then you have this function telling what should be shown in the cells of your tableview...
It is displaying its information based on the |
TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.