StanfordSpezi / Spezi

Open-source framework for rapid development of modern, interoperable digital health applications.
https://swiftpackageindex.com/StanfordSpezi/Spezi/documentation
MIT License
145 stars 11 forks source link

Support iteration in builtin SharedRepository implementations #81

Closed Supereg closed 1 year ago

Supereg commented 1 year ago

Support iteration in builtin SharedRepository implementations

:recycle: Current situation & Problem

Currently, we have no ability to access the elements in our built in shared repositories in a type-erased way. Specifically, we have no way to iterate over them.

:bulb: Proposed solution

This PR addresses this issue by adding Collection conformance for our two builtin Shared Repository types and extending the AnyRepositoryValue type.

:gear: Release Notes

:heavy_plus_sign: Additional Information

Related PRs

This feature will be useful in https://github.com/StanfordSpezi/SpeziAccount/pull/7 for a Account Service to process modified account details.

Testing

Additionally unit tests were included.

Reviewer Nudging

--

Code of Conduct & Contributing Guidelines

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

codecov[bot] commented 1 year ago

Codecov Report

Merging #81 (85c98c0) into main (9ad506d) will increase coverage by 0.11%. The diff coverage is 100.00%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/81/graphs/tree.svg?width=650&height=150&src=pr&token=KHU2K1HTAM&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi)](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/81?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) ```diff @@ Coverage Diff @@ ## main #81 +/- ## ========================================== + Coverage 97.52% 97.63% +0.11% ========================================== Files 34 34 Lines 604 631 +27 ========================================== + Hits 589 616 +27 Misses 15 15 ``` | [Files Changed](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/81?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) | Coverage Δ | | |---|---|---| | [...pezi/SharedRepository/Builtin/HeapRepository.swift](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/81?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aS9TaGFyZWRSZXBvc2l0b3J5L0J1aWx0aW4vSGVhcFJlcG9zaXRvcnkuc3dpZnQ=) | `100.00% <100.00%> (ø)` | | | [...ezi/SharedRepository/Builtin/ValueRepository.swift](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/81?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aS9TaGFyZWRSZXBvc2l0b3J5L0J1aWx0aW4vVmFsdWVSZXBvc2l0b3J5LnN3aWZ0) | `100.00% <100.00%> (ø)` | | | [...urces/Spezi/SharedRepository/RepositoryValue.swift](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/81?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aS9TaGFyZWRSZXBvc2l0b3J5L1JlcG9zaXRvcnlWYWx1ZS5zd2lmdA==) | `100.00% <100.00%> (ø)` | | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/81?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/81?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi). Last update [9ad506d...85c98c0](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/81?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi).