Skip to content

feat: added common strategies applicable to all properties #129

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

soumyamahunt
Copy link
Contributor

@soumyamahunt soumyamahunt commented May 20, 2025

Added support for applying common strategies (like ValueCoder) to all properties of a type using the @codable macro's commonStrategies parameter.

Features:

  • Added HelperCoderStrategy for specifying common type conversion strategies
  • Added CodableCommonStrategy for use with @codable macro
  • Added StrategyFinder to extract and apply common strategies during macro expansion
  • Added comprehensive test suite for common strategies functionality

Example usage:

@Codable(commonStrategies: [.codedBy(.valueCoder())])
struct Model {
    let int: Int      // Uses ValueCoder<Int>
    let url: URL      // Uses standard Codable (not ValueCodingStrategy)
    let string: String // Uses ValueCoder<String>
}

resolves #93, resolves #51

Copy link

codecov bot commented May 20, 2025

Codecov Report

Attention: Patch coverage is 95.95960% with 4 lines in your changes missing coverage. Please review.

Project coverage is 94.92%. Comparing base (cc973b0) to head (e013047).

Files with missing lines Patch % Lines
.../HelperCoders/Strategies/HelperCoderStrategy.swift 0.00% 3 Missing ⚠️
...es/MetaCodable/Codable/CodableCommonStrategy.swift 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #129      +/-   ##
==========================================
- Coverage   94.99%   94.92%   -0.07%     
==========================================
  Files         109      113       +4     
  Lines        4312     4411      +99     
==========================================
+ Hits         4096     4187      +91     
- Misses        216      224       +8     

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant