<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 10, 2017, at 19:01, Charles Srstka via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><blockquote type="cite" class="">On Jun 8, 2017, at 2:35 PM, Tony Allevato via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class="">It is an extremely rare case for a developer to know a priori what literal numeric indices should be used when indexing into a string, because it only applies when strings fall into a very specific format and encoding.<br class=""></blockquote><br class="">Knowing this is required for accessibility support on macOS, since it’s needed to implement NSAccessibility methods such as accessibilityAttributedString(for:), accessibilityRTF(for:), accessibilityFrame(for:), etc.</div></div></blockquote><br class=""></div><div>I think Tony was getting at knowing the <i class="">best</i> indices for a string, vs. a format or API that is documented to use UTF-8 or UTF-16 indexes specifically (like, unfortunately, most of Cocoa and Cocoa Touch). It stinks that those may not be random-access if the underlying string buffer turns out to not be UTF-16, but that's true with NSString as well.</div><div><br class=""></div><div>Jordan</div><br class=""></body></html>