simplify cast of string.index to int before i forget

This commit is contained in:
Hailey
2024-01-11 22:02:30 -08:00
parent 648552eafb
commit fbca531bdf
@@ -130,10 +130,7 @@ class ExpoSelectableTextView: ExpoView {
let range = text.range(of: segment.text)
// Figure out the bounds
if let lowerBound = range?.lowerBound, let upperBound = range?.upperBound {
let lowerIndex = text.distance(from: text.startIndex , to: lowerBound)
let upperIndex = text.distance(from: text.startIndex, to: upperBound)
if charIndex >= lowerIndex, charIndex <= upperIndex {
if charIndex >= lowerBound.utf16Offset(in: text), charIndex <= upperBound.utf16Offset(in: text) {
foundSegment = segment
}
}