Repository navigation
Fix CALayerInvalidGeometry crash when reparenting views on iPadOS 27 - #25
Merged
Merged
Conversation
`LayoutArrangement.addSubview(_:maintainCoordinates:)` converted the reparented view's frame to and from `UIScreen.main.fixedCoordinateSpace`. On iPadOS 27 a window that is not full screen (resized at runtime, or launched inside a Stage Manager window) gets a window scene whose `screen` is not `UIScreen.main`, and converting between the two unrelated screens returns `(inf, inf, 0, 0)`. Assigning that frame throws `CALayerInvalidGeometry`, which Crashlytics shows on iPad / iPadOS 27 only. Convert via the window instead (`convert(_, to: nil)`); views reparented by an arrangement always share a window. Also skip the frame assignment when the converted rect has non-finite components, so the arrangement's real frame from `Animation.apply()` wins instead of crashing. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
antonsoderdahl
approved these changes
Oct 9, 2026
antonsoderdahl
left a comment
Contributor
There was a problem hiding this comment.
If you say so. Känns inte som jag har så starka åsikter om kodkvalitén på layoutkit här så funkar det så kör. ;)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Crashlytics shows
CALayerInvalidGeometryinLayoutArrangement.makeSubviews→UITextView.setFrame:on iPads running iPadOS 27 only.LayoutArrangement.addSubview(_:maintainCoordinates:)converts the reparented view's frame to and fromUIScreen.main.fixedCoordinateSpace. On iPadOS 27 a window that is not full screen (resized at runtime, or launched inside a Stage Manager window) gets a window scene whosescreenis notUIScreen.main. Converting between the two unrelated screens returns(inf, inf, 0, 0), and assigning that as a frame throws.Measured with a probe app on the iPadOS 27 simulator: the state persists for the whole process lifetime (survives taps and background/foreground), and with Stage Manager on it is present from launch, which matches the same device crashing twice within 100 s in Crashlytics.
convert(_, to: nil)returns the correct rect in the same state.Fix
UIKitSupport.swift: convert via the window (to: nil/from: nil) instead ofUIScreen.main, which has also been deprecated since iOS 16. Views reparented by an arrangement always share a window.LayoutArrangement.swift: skip the frame assignment when the converted rect has non-finite components. The arrangement's real frame is applied byAnimation.apply()right after anyway.Verification
Release
Tag
10.0.11after merge, then bumpexactVersionandPackage.resolvedin iphoneshell.🤖 Generated with Claude Code