Post

Replies

Boosts

Views

Activity

Editable text disappears during iOS 27 grammar checking
I’m seeing in issue on iOS 27 with TextKit 1 backed UITextViews where grammar checking makes part of the text disappear. For TextKit 2 views, there's a blue underline and a shimmer effect that's applied to the text when a grammatical error is detected. For TextKit 1 views the underline appears but instead of the shimmer effect, the text just disappears. Steps to reproduce: Create a UITextView using TextKit 1: UITextView(usingTextLayoutManager: false) Fill it with a very long document (makes the bug easier to reproduce). Type a phrase that triggers a grammar correction, such as “self aware”. Wait for the system to suggest “self-aware”. The blue underline appears but the two words disappear. I've found a partial workaround by overriding NSLayoutManager.drawGlyphsForGlyphRange and calling CGContextSetFillColorWithColor on the affected range, but this isn't great. Filed as FB24319258. Has anyone else encountered this on the iOS 27 betas? Would appreciate any guidance.
0
0
31
15h
Tapping a TextKit 2 backed UITextView moves the caret to a random location
With the upcoming launch of Apple Intelligence and Writing Tools, we've been forced to migrate our text editing app to TextKit 2. As soon as we released the update, we immediately got complaints about incorrect selection behaviour, where the user would tap a word to begin editing, but the caret would be shown in an undefined location, often dozens of paragraphs below the selected content. To reproduce: Create a UITextView backed by a standard TextKit 2 stack and a large amount of text (50,000+ words) - see sample project below Scroll quickly through the text view (at least 20% of the way down) Tap once to select a position in the document. Expected: The caret appears at the location the user tapped, and UITextView.selectedRange is the range of the text at the location of the tap. This is the behaviour of TextKit 1 based UITextViews. Actual: The caret is positioned at an undefined location (often completely off screen), and the selectedRange is different to the range at the location of the tap, often by several thousand. There is no pattern to the magnitude of the discrepancy. This incorrect behaviour occurs consistently in the sample project on the simulator, but you may need to hide the keyboard by pulling down, then repeat steps 2-3 a few times. This happens on iPhone and iPad, and on iOS 17, 18, and 18.1. Do you have any insight into why this might be happening or how to work around this issue? Sample code is here: https://github.com/nathantesler/textkit2-issue/tree/master
2
0
817
Sep ’24
How to restore specific scenes in SwiftUI
I'm trying to implement multiple window support for my app, but the system restores the wrong scene when the app is relaunched. Here's my code: import SwiftUI @main struct TestApp: App { @Environment(\.openWindow) private var openWindow var body: some Scene { WindowGroup(id: "Navigator") { Button { openWindow(id: "Editor", value: "test") } label: { Text("Open Window") } } WindowGroup(id: "Editor", for: String.self) { id in Text(id.wrappedValue ?? "none") } } } If I run the app and tap the button, the Editor window opens. If I force quit and open the app again, the app still has two windows open but both are Navigator windows. I've tried adding handlesExternalEvents to the Scene and advertising an activity with .userActivity(isActive:), neither changes this behaviour. Any advice?
0
0
367
Jul ’24
Editable text disappears during iOS 27 grammar checking
I’m seeing in issue on iOS 27 with TextKit 1 backed UITextViews where grammar checking makes part of the text disappear. For TextKit 2 views, there's a blue underline and a shimmer effect that's applied to the text when a grammatical error is detected. For TextKit 1 views the underline appears but instead of the shimmer effect, the text just disappears. Steps to reproduce: Create a UITextView using TextKit 1: UITextView(usingTextLayoutManager: false) Fill it with a very long document (makes the bug easier to reproduce). Type a phrase that triggers a grammar correction, such as “self aware”. Wait for the system to suggest “self-aware”. The blue underline appears but the two words disappear. I've found a partial workaround by overriding NSLayoutManager.drawGlyphsForGlyphRange and calling CGContextSetFillColorWithColor on the affected range, but this isn't great. Filed as FB24319258. Has anyone else encountered this on the iOS 27 betas? Would appreciate any guidance.
Replies
0
Boosts
0
Views
31
Activity
15h
Tapping a TextKit 2 backed UITextView moves the caret to a random location
With the upcoming launch of Apple Intelligence and Writing Tools, we've been forced to migrate our text editing app to TextKit 2. As soon as we released the update, we immediately got complaints about incorrect selection behaviour, where the user would tap a word to begin editing, but the caret would be shown in an undefined location, often dozens of paragraphs below the selected content. To reproduce: Create a UITextView backed by a standard TextKit 2 stack and a large amount of text (50,000+ words) - see sample project below Scroll quickly through the text view (at least 20% of the way down) Tap once to select a position in the document. Expected: The caret appears at the location the user tapped, and UITextView.selectedRange is the range of the text at the location of the tap. This is the behaviour of TextKit 1 based UITextViews. Actual: The caret is positioned at an undefined location (often completely off screen), and the selectedRange is different to the range at the location of the tap, often by several thousand. There is no pattern to the magnitude of the discrepancy. This incorrect behaviour occurs consistently in the sample project on the simulator, but you may need to hide the keyboard by pulling down, then repeat steps 2-3 a few times. This happens on iPhone and iPad, and on iOS 17, 18, and 18.1. Do you have any insight into why this might be happening or how to work around this issue? Sample code is here: https://github.com/nathantesler/textkit2-issue/tree/master
Replies
2
Boosts
0
Views
817
Activity
Sep ’24
How to restore specific scenes in SwiftUI
I'm trying to implement multiple window support for my app, but the system restores the wrong scene when the app is relaunched. Here's my code: import SwiftUI @main struct TestApp: App { @Environment(\.openWindow) private var openWindow var body: some Scene { WindowGroup(id: "Navigator") { Button { openWindow(id: "Editor", value: "test") } label: { Text("Open Window") } } WindowGroup(id: "Editor", for: String.self) { id in Text(id.wrappedValue ?? "none") } } } If I run the app and tap the button, the Editor window opens. If I force quit and open the app again, the app still has two windows open but both are Navigator windows. I've tried adding handlesExternalEvents to the Scene and advertising an activity with .userActivity(isActive:), neither changes this behaviour. Any advice?
Replies
0
Boosts
0
Views
367
Activity
Jul ’24