typesense / typesense-swift

Swift Client for Typesense ⚡️🔎
https://typesense.org/docs/
Apache License 2.0
39 stars 16 forks source link

StringQuantum Conversion #16

Closed DominiCanes closed 2 years ago

DominiCanes commented 2 years ago

How do I actually convert the StringQuantum to a [String] and access each word in there? For example I have: hits![indexPath.row].highlights![0].matchedTokens! Yet I am stuck with the StringQuantum data type and have no idea how to convert it to an array of Strings.

programVeins commented 2 years ago

Hey! I didn't realise I had missed this part earlier! Just wrote a small patch to get back your value of MatchedTokens from the StringQuantum

You can extract them from your StringQuantum type with .arrStr if it's an array of strings and .arrArrStr if it's an array of array of strings. Both of them return an optional and both cannot have values at the same time - it's only either one that you would want.

Fixed this in #17 Will be dropping a release soon 😁

DominiCanes commented 2 years ago

Thank you so much!