There is a bug in the highlight function. It occurs when more than one range is in the input.
Line 22: highlightString.append(self.containAttribute(originText: originText, bound: ranges[i], attributes: highlightAttributes))
It takes wrong occurrence. Next, instead of needed one.
For example if originText = "String string String" and searchText = "string", then result will be (omitting attributes) "string String String". In fact you can clearly see this bug in the introduction gif (https://raw.githubusercontent.com/younatics/Highlighter/master/Images/Highlighter.gif)
There is a bug in the highlight function. It occurs when more than one range is in the input.
Line 22:
highlightString.append(self.containAttribute(originText: originText, bound: ranges[i], attributes: highlightAttributes))It takes wrong occurrence. Next, instead of needed one.
For example if originText = "String string String" and searchText = "string", then result will be (omitting attributes) "string String String". In fact you can clearly see this bug in the introduction gif (https://raw.githubusercontent.com/younatics/Highlighter/master/Images/Highlighter.gif)