peter this seems related to the issue I emailed you about with the slow app start (4-5 seconds).
I digged in a bit more, and it seems like the culprit is this:
UITextView 0x1087c8e00 is switching to TextKit 1 compatibility mode because its layoutManager was accessed. Break on void _UITextViewEnablingCompatibilityMode(UITextView *__strong, BOOL) to debug.
I asked our newest bestest friend GPT about it, and here's what it says 🙂
...the TextKit message is a flag that can indicate slowdown if the layoutManager is accessed and UITextView falls back to TextKit 1 compatibility mode. That can affect UI rendering and launch times, especially if you initialize large text or rich-text objects at launch.
Recommended debugging steps (quick, actionable)
- Find where in your code you access UITextView.layoutManager, attributedText, textStorage, or textView.layoutManager.delegate during app startup (application:didFinishLaunchingWithOptions:, SceneDelegate, or early viewDidLoad) — defer those accesses by making them lazy-initialized.
- Breakpoint: set a breakpoint in Xcode on _UITextViewEnablingCompatibilityMode(...) (the function named in the console message), run the app and inspect the call stack — that will show the code path that accessed the layoutManager.
- If you use large NSTextStorage/attributed strings: prepare a simplified or preprocessed version, or load them on a background thread and dispatch only the final UI update to the main thread.
- Ensure you’re not manipulating the layoutManager directly (e.g., addLayoutManager:, replaceCharactersInRange:, etc.) during startup on the main thread without batching; use performBatchUpdates or UIView.performWithoutAnimation and avoid synchronous file/DB reads during UI initialization.
- Test: comment out the UITextView initialization at launch — if startup becomes faster, you’ve confirmed the source.
Instruments-focused checks
- Time Profiler: watch for main-thread glyph layout/text-storage work and NSTextStorage operations.
- Main Thread Checker: detect any UI calls made from background threads.
If you send the breakpoint call stack or the code that creates/configures the UITextView, I’ll provide an exact fix and a code example for lazy initialization or asynchronous loading.