Merged
Conversation
Contributor
Author
|
Solves: #168 |
Collaborator
TestThis works nicely. The singular matrix indication in debug log is gone. The Nightscout plot populates much faster. |
marionbarker
approved these changes
Mar 15, 2026
Collaborator
marionbarker
left a comment
There was a problem hiding this comment.
Approved by code review and test.
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.
This change prevents repeated console warnings:
CGAffineTransformInvert: singular matrixThese warnings occur when the Charts library attempts to invert a transform matrix while the chart view temporarily has zero dimensions (for example before layout is complete). In this situation the matrix is singular (determinant = 0), and calling
.inverted()triggers the warning.The fix adds a simple guard before performing the inversion. If the matrix determinant is zero,
.identityis returned instead of attempting the inversion.This is safe because a singular matrix means the chart has no meaningful size yet, so there is nothing useful to transform.
Since the code lives inside a CocoaPods dependency (
Charts), the fix is applied in two ways:Pods/Charts/Source/Charts/Utils/Transformer.swiftpost_installhook in thePodfilethat re-applies the patch automatically whenpod installrunsThis removes the warnings without affecting chart rendering or behavior.