simplify cast of string.index to int before i forget
This commit is contained in:
@@ -130,10 +130,7 @@ class ExpoSelectableTextView: ExpoView {
|
|||||||
let range = text.range(of: segment.text)
|
let range = text.range(of: segment.text)
|
||||||
// Figure out the bounds
|
// Figure out the bounds
|
||||||
if let lowerBound = range?.lowerBound, let upperBound = range?.upperBound {
|
if let lowerBound = range?.lowerBound, let upperBound = range?.upperBound {
|
||||||
let lowerIndex = text.distance(from: text.startIndex , to: lowerBound)
|
if charIndex >= lowerBound.utf16Offset(in: text), charIndex <= upperBound.utf16Offset(in: text) {
|
||||||
let upperIndex = text.distance(from: text.startIndex, to: upperBound)
|
|
||||||
|
|
||||||
if charIndex >= lowerIndex, charIndex <= upperIndex {
|
|
||||||
foundSegment = segment
|
foundSegment = segment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user