Closed frboulais closed 2 years ago
Hi @frboulais ,
I'm not sure if I understood your concern. The Hit
is a generic wrapper for any type conforming to Codable
protocol.
So you can declare your hits interactor as HitsInteractor<Hit<Item>>
and connect it to a HitsSearcher
.
The hits will be properly decoded as a list of Hit<Item>
objects, so you can easily access the highlighted values.
By the way, InstantSearch SwiftUI provides a convenient extension for Text
to construct a highlighted text view.
Hey @VladislavFitz ! Thank you very much for your reply! It works exactly as expected! Sorry for this issue and thank you for your great work :) Have a great day!
Is your feature request related to a problem? Please describe 🙏 Yes, I don't find anyway using highlights in InstantSearch for SwiftUI
Describe the solution you'd like 🤔 Having a
[Hit<Item>]
getter inHitsInteractor
||HitsObservableController
soHighlightedString
instances can be retrieved for desired fields. Or even better, implement the decoder of HighlightedString so it can be automatically decoded from the Codable Hit model.Describe alternatives you've considered ✨ Decode the hits by myself from
HitsSearcher
hits getter ([Hit<JSON>]
).Additional context