Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CodableWithConfiguration when storing and retrieving from LocalStorage #24

Merged
merged 3 commits into from
Aug 28, 2024

Conversation

Supereg
Copy link
Member

@Supereg Supereg commented Aug 26, 2024

Support CodableWithConfiguration when storing and retrieving from LocalStorage

♻️ Current situation & Problem

As of know, we only support storage and retrieval using Encodable and Decodable types. iOS 17 introduced a new set of protocols: EncodableWithConfiguration and DecodableWithConfiguration. Instead of relying on the userInfo dictionary and runtime checks to ensure configuration is supplied on the call site, type can now strictly define a certain configuration type that has to be supplied when encoding or decoding. There is also a new @CodableConfiguration property wrapper that can be used to statically define configurations for nested types.

To embrace these strongly typed configurations, SpeziStorage add support to accept types of these new protocols. We rely on the newly introduced TopLevelEncoder and TopLevelDecoder protocols introduced with StanfordSpezi/SpeziFoundation#15 to stay generic over the encoder and decoder.

⚙️ Release Notes

  • Support storage and retrieval of CodableWithConfiguration types.
  • Improved documentation.

📚 Documentation

This PR reworks some of the documentation structure of SpeziStorage. Reducing some of the fluff and reorganizing the catalog a bit.

✅ Testing

--

📝 Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

@Supereg Supereg requested a review from PSchmiedmayer August 26, 2024 17:30
Copy link

codecov bot commented Aug 26, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 10 lines in your changes missing coverage. Please review.

Project coverage is 90.28%. Comparing base (099e059) to head (0b9b0b9).
Report is 1 commits behind head on main.

Files Patch % Lines
Sources/SpeziLocalStorage/LocalStorage.swift 66.67% 10 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #24      +/-   ##
==========================================
- Coverage   92.06%   90.28%   -1.77%     
==========================================
  Files           6        6              
  Lines         453      473      +20     
==========================================
+ Hits          417      427      +10     
- Misses         36       46      +10     
Files Coverage Δ
...ources/SpeziLocalStorage/LocalStorageSetting.swift 97.30% <ø> (ø)
Sources/SpeziSecureStorage/Credentials.swift 100.00% <ø> (ø)
Sources/SpeziSecureStorage/SecureStorage.swift 93.97% <ø> (ø)
...es/SpeziSecureStorage/SecureStorageItemTypes.swift 100.00% <ø> (ø)
...ources/SpeziSecureStorage/SecureStorageScope.swift 82.46% <ø> (ø)
Sources/SpeziLocalStorage/LocalStorage.swift 83.07% <66.67%> (-6.35%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 099e059...0b9b0b9. Read the comment docs.

Copy link
Member

@PSchmiedmayer PSchmiedmayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the nice additions; looks great to me!

Package.swift Outdated Show resolved Hide resolved
Package.swift Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Sources/SpeziSecureStorage/Credentials.swift Outdated Show resolved Hide resolved
@Supereg Supereg merged commit 6096237 into main Aug 28, 2024
17 of 18 checks passed
@Supereg Supereg deleted the feature/codable-with-configuration branch August 28, 2024 09:25
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