Skip to content

Make inverting Y axis optional (with non-breaking default)#9

Merged
nicklockwood merged 2 commits into
nicklockwood:mainfrom
leehericks:main
Dec 21, 2025
Merged

Make inverting Y axis optional (with non-breaking default)#9
nicklockwood merged 2 commits into
nicklockwood:mainfrom
leehericks:main

Conversation

@leehericks

Copy link
Copy Markdown
Contributor

As discussed in #3, this pull request allows setting parse options such that the y-axis will not be flipped, and it defaults to flipping, so this is not a breaking change.

I implemented this in the exact same format as the author's WriteOptions struct to be consistent.

I've used this with success to render kanji characters in SVG format.

let svgPath = try! SVGPath(string: pathData, with: .init(invertYAxis: false))
let cgPath = try! CGPath.from(svgPath: svgPath, with: .init(invertYAxis: false))

@nicklockwood

Copy link
Copy Markdown
Owner

Amazing! Thanks so much ❤️

@codecov

codecov Bot commented Dec 21, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.95%. Comparing base (381fd60) to head (2de40d0).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
Sources/SVGPath.swift 76.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #9      +/-   ##
==========================================
+ Coverage   51.46%   51.95%   +0.49%     
==========================================
  Files           2        2              
  Lines         581      587       +6     
==========================================
+ Hits          299      305       +6     
  Misses        282      282              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nicklockwood nicklockwood merged commit 26c57c3 into nicklockwood:main Dec 21, 2025
6 checks passed
@leehericks

Copy link
Copy Markdown
Contributor Author

@nicklockwood Did you accidentally remove the change to SVGPath+CoreGraphics.swift when or after you merged this?

@nicklockwood

Copy link
Copy Markdown
Owner

I deliberately removed it - I don't think it's necesary to have that option when creating a CGPath from a String since you can use the convenience API available directly on SwiftUI.Path, or use the CGPath.from(SVGPath) version if you need an inverted CGPath for some reason

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants