Skip to content

Store url as a stored property instead of computed property - #49

Merged
nearfri merged 1 commit into
mainfrom
url-stored-property
Jun 25, 2026
Merged

nearfri merged 1 commit into
mainfrom
url-stored-property

Conversation

@nearfri

@nearfri nearfri commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Change the generated url from a computed property to a stored property, computed once in init.

Why

On versions below iOS 26, URL.path(percentEncoded:) misbehaves, so standardizedFileURL is used to get a correct path. Because standardizedFileURL is relatively expensive, computing it on every url access (as a computed property) is wasteful — so it is now computed once in init and stored.

let url = URL(filePath: "Library", relativeTo: URL(fileURLWithPath: "/System"))
print(url.path(percentEncoded: false)) // iOS18: Library, iOS26: /System/Library
print(url.standardizedFileURL.path(percentEncoded: false)) // All: /System/Library

@nearfri nearfri self-assigned this Jun 25, 2026
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.80%. Comparing base (c81a23f) to head (db336f4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #49      +/-   ##
==========================================
+ Coverage   96.79%   96.80%   +0.01%     
==========================================
  Files         125      125              
  Lines        5612     5635      +23     
==========================================
+ Hits         5432     5455      +23     
  Misses        180      180              

☔ View full report in Codecov by Harness.
📢 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.

@nearfri
nearfri merged commit 5658ca5 into main Jun 25, 2026
4 checks passed
@nearfri
nearfri deleted the url-stored-property branch June 25, 2026 04:45
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