generated from StanfordBDHG/SwiftPackageTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Encoding and Decoding of AccountDetails with strongly typed configura…
…tion (#69) # Encoding and Decoding of AccountDetails with strongly typed configuration ## ♻️ Current situation & Problem The current approach of decoding and encoding `AccountDetails` relies on setting the expected `userInfo` keys on the encoder and decoder instance. While is highlighted in documentation, there is no compile-time check that there isn't any mistake in the configuration (e.g., missing keys or values with unexpected type). iOS 17 introduced the `CodableWithConfiguration` protocols that allow to set a configuration type for encoding and decoding. This PR migrates the current approach to adopting the `EncodableWithConfiguration` protocol and replacing the `Decodable` conformance with `DecodableWithConfiguration`. The requirement to pass a configuration upon decoding is now expressed with the type system and will produce a compiler warning if not done correctly. ## ⚙️ Release Notes * Add `EncodingConfiguration` and `DecodingConfiguration` for AccountDetails and conformance to `CodableWithConfiguration`. The `Decodable` conformance was dropped. ## 📚 Documentation Documentation was added for new interfaces and updated to point to the new configuration types. ## ✅ Testing Existing unit test verify that the new implementation doesn't break any expected behavior. ## 📝 Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
- Loading branch information
Showing
6 changed files
with
161 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
Sources/SpeziAccount/AccountValue/Keys/AccountDetailsFlags.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.