UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Using the Document App template, editing in middle of long text results in scroll position jumping around making cursor out of view

Forums > SwiftUI

How is this fixed?

I usually test with the text of Pride & Prejudice from https://www.gutenberg.org/files/1342/1342-h/1342-h.htm
Scroll down past Chapter 4, select a new cursor position, enter some text, wait several seconds, enter a few spaces, wait several seconds, press enter once or twice, wait several seconds. The scroll position during any of these wait periods is likely to move on its own, possibly more than once, such that the cursor position is now out of view.

My current setup as of 11/19/2022: Xcode 14.0, macOS 12.5.1, Mac mini M1 2020. This behavior happens in any of the iPad simulators I try. It also happens when deployed to my iPad of model MR7J2LL/A running iPadOS 16.1.

I've seen this behavior in multiple earlier versions of Xcode, macOS, and iPadOS.

Please help!

1      

For what it's worth, the cursor position jumping seems to occur more readily when specifying .font(.largeTitle) or a custom font.

I'm really hoping someone knows of a fix or a workaround for this (besides using a tiny font!).

1      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.