Skip to content

Conversation

swhitty
Copy link
Owner

@swhitty swhitty commented Aug 31, 2025

Adds SVGCache which is used to cache parsed SVG instances from disk.

When using SVG or SVGView with images stored on the disk, instances are now stored within a NSCache so subsequent reloads are near instant and do not need to parse the file into a DOM and create the render commands.

Below all 3 views draw the same SVG but it is only parsed and process once;

VStack {
   SVGView("sample.svg")
   SVGView("sample.svg")
   SVGView("sample.svg")
}

Copy link

codecov bot commented Aug 31, 2025

Codecov Report

❌ Patch coverage is 96.62921% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.00%. Comparing base (55dfc53) to head (20a5e7f).

Files with missing lines Patch % Lines
...Sources/LayerTree/LayerTree.CommandGenerator.swift 93.75% 2 Missing ⚠️
.../Sources/Renderer/Renderer.CoreGraphics+Cost.swift 96.82% 2 Missing ⚠️
SwiftDraw/Sources/SVG.swift 81.81% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #101      +/-   ##
==========================================
+ Coverage   89.89%   90.00%   +0.10%     
==========================================
  Files         144      147       +3     
  Lines       12451    12617     +166     
==========================================
+ Hits        11193    11356     +163     
- Misses       1258     1261       +3     

☔ 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.

@swhitty swhitty merged commit af422b9 into main Aug 31, 2025
16 checks passed
@swhitty swhitty deleted the svg-cache branch August 31, 2025 09:58
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.

1 participant