To compute the x position of the substring, you can simply multiply the number of chars before by char width in the font (will give approximate value, but should be enough here) or use sizeWithAttributes. This could help: https://stackoverflow.com/questions/37475593/swift-how-do-i-find-the-positionx-y-of-a-letter-in-a-uilabel
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: