Eureka icon indicating copy to clipboard operation
Eureka copied to clipboard

SearchBar in "MultipleSelectorViewController" and "SelectorViewController"

Open YSDC opened this issue 8 years ago • 25 comments

It could be really useful to have the possibility to display a search bar in the given view controllers in order for the user to filter its content.

I give you an example. I have to let the user select a country, and the languages he speaks. I let you imagine his pain when he has to scroll over all the countries and languages, without being able to simply type the first letters of the desired country, or language.

Maybe I missed it, but I didn't found anything yet in the Eureka project about it.

YSDC avatar Apr 28 '16 15:04 YSDC

Anyway, i've done my own extension of your views, works like a charm ;)

YSDC avatar May 02 '16 07:05 YSDC

Hey @YSDC I would be a great feature. How did you implement it?

In terms of feature usage I believe it can be set up from row.onPresent callback. You might have changed MultipleSelectorViewController and SelectorViewController to add filter support.. right?

mtnbarreto avatar May 02 '16 15:05 mtnbarreto

Exactly. I have create a FilterPushRow and FilterMultiplePushRowwith both their own controller. I have reuse as much as i can what exist in Eureka, but modified enough to let the user define it's own type and support filter. If you are interested i can share them with you.

I have also create a new Row with a dictionary<String,Set<T>> as value to handle Sections :-)

YSDC avatar May 04 '16 12:05 YSDC

@YSDC Could you please share the code, eventually we can merge it. I would have prefered some customization on PushRow and MultiplePushRow rather than creating brand new rows. What do you think?

mtnbarreto avatar May 04 '16 14:05 mtnbarreto

Yes, sounds better.

I will fork the code, create a branch an do a pull request.

With luck, i could do it before the end of the week (bank holiday in Switzerland :smile: )

YSDC avatar May 04 '16 14:05 YSDC

sounds great! Hopefully we merge this feature soon!

mtnbarreto avatar May 04 '16 14:05 mtnbarreto

@YSDC I am currently looking into doing this as well. Would you mind sharing the new code you used to accomplish this with a sample? It would be greatly appreciated; thank you!

plastus avatar May 05 '16 14:05 plastus

+1

ph3b avatar May 11 '16 19:05 ph3b

Any update on this? Would be useful in my project!

pbush25 avatar Jun 25 '16 03:06 pbush25

I implemented a search bar controller into SelectorViewController. However, due to the slow performance of evaluateHidden() I modified the code slightly to essentially destroy the form and re-create it using the filtered row options. This is obviously much faster than setting each row's hidden property, although I wonder if setting the hidden property equal to a function that evaluates whether the row should be hidden (by comparing against a simple array) would be faster. I'll give this a try later on and report back. If anyone else has any other suggestions, please feel free to share. :)

plastus avatar Jun 27 '16 13:06 plastus

+1, it would be a really useful feature!

aalfath avatar Jun 29 '16 11:06 aalfath

I shared my implementation of a Searchable PushRow here, since the controller is implemented from scratch and is not descendant from FormViewController is far more performant than recreating the whole form, section and items everytime the user types a query in the search box via updateSearchResultsForSearchController.

bithavoc avatar Jul 04 '16 20:07 bithavoc

@bithavoc Any chance you could provide an example of your SearchablePushRow updated for Swift 3?

Mike278 avatar Dec 20 '16 18:12 Mike278

@mikaoj this is all I have for now, I'm going through the migration myself so I still need to add a few tweaks. Check it out: https://gist.github.com/bithavoc/f5c9d06f024bfb5d9d3bd9452b94849f

The main problem is PushRow uses PresentationMode which only works with UIViewController and I need to use UITableViewController for the search bar so I had to implement my own row but I think it might be a good starting point.

bithavoc avatar Dec 20 '16 19:12 bithavoc

Did anyone manage to implement a searchable multipleselector row?

magicmikek avatar Feb 09 '17 16:02 magicmikek

@magicmikek yes, it's all in the gist.

bithavoc avatar Feb 09 '17 16:02 bithavoc

@bithavoc You said above that a searchable multipleSelectorRow implementation is in the gist. I don't see anything related to multi-select in your gist above: https://gist.github.com/bithavoc/f5c9d06f024bfb5d9d3bd9452b94849f

Is there something newer? Great work on this. The replacement for PushRow is excellent.

jkgz avatar Mar 07 '17 19:03 jkgz

@jkgz I misread the requirement, you're right, no multipleSelectorRow here, just an efficient search capability. sorry @magicmikek 🙏

bithavoc avatar Mar 07 '17 19:03 bithavoc

Any update ?

RSickenberg avatar Apr 19 '17 13:04 RSickenberg

+1 on this idea. I am looking for a way to get a search bar on my Push Row. Any updates on this feature? Would be nice to have a customization on Push Row instead of having to implement another row type.

martheli avatar Aug 02 '17 23:08 martheli

@bithavoc Thanks for creating a gist for the searchable Eureka view controller row. Do you have an example on how to use it? Edit: figured it out on my own (this is just a starter point):

<<< ComposableSearchablePushRow<Company>("Test") { row in
}

class Company: NSObject, SearchableItem {
    func matchesSearchQuery(_ query: String) -> Bool {
        return true
    }
}

csr avatar Aug 19 '17 18:08 csr

So, no SearchController inside Eureka for now ?

RSickenberg avatar Aug 25 '17 13:08 RSickenberg

+1

amadeu01 avatar Mar 22 '19 21:03 amadeu01

@YSDC Is it possible to share the sample code for FilterPushRow and FilterMultiplePushRow using swift 4.2 or above ?

wilz05 avatar May 16 '19 05:05 wilz05

Any progress on FilterMultiplePushRow?

Lawlis avatar Mar 22 '21 13:03 Lawlis