From fbca531bdfeff90bd2a99214482e102f2601c453 Mon Sep 17 00:00:00 2001 From: Hailey Date: Thu, 11 Jan 2024 22:02:30 -0800 Subject: [PATCH] simplify cast of string.index to int before i forget --- .../expo-selectable-text/ios/ExpoSelectableTextView.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/expo-selectable-text/ios/ExpoSelectableTextView.swift b/modules/expo-selectable-text/ios/ExpoSelectableTextView.swift index 681ad5b53f..cc7b17dc10 100644 --- a/modules/expo-selectable-text/ios/ExpoSelectableTextView.swift +++ b/modules/expo-selectable-text/ios/ExpoSelectableTextView.swift @@ -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 } }