StanfordSpezi / Spezi

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

Support dynamic initialization of optional dependencies #96

Closed Supereg closed 5 months ago

Supereg commented 5 months ago

Support dynamic initialization of optional dependencies

:recycle: Current situation & Problem

Optional dependencies are already supported by Spezi. However, they lack the ability to dynamically supply a default value. Currently, you can only declare an optional dependency and check if it was configured e.g. by the user. But it wasn't possible to provide a default value (e.g., behind some runtime check) yourself.

:gear: Release Notes

:books: Documentation

Documentation was added and updated.

:white_check_mark: Testing

Extensive testing was added for the new initializer, testing all possible combinations of initialization.

:pencil: 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 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (bf2f55b) 91.20% compared to head (51a1879) 91.34%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/96/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/96?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) ```diff @@ Coverage Diff @@ ## main #96 +/- ## ========================================== + Coverage 91.20% 91.34% +0.14% ========================================== Files 34 34 Lines 693 704 +11 ========================================== + Hits 632 643 +11 Misses 61 61 ``` | [Files](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/96?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) | Coverage Δ | | |---|---|---| | [...Spezi/Dependencies/DependencyPropertyWrapper.swift](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/96?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aS9EZXBlbmRlbmNpZXMvRGVwZW5kZW5jeVByb3BlcnR5V3JhcHBlci5zd2lmdA==) | `91.23% <100.00%> (+0.49%)` | :arrow_up: | | [Sources/Spezi/Spezi/SpeziAppDelegate.swift](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/96?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aS9TcGV6aS9TcGV6aUFwcERlbGVnYXRlLnN3aWZ0) | `100.00% <100.00%> (ø)` | | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/96?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/96?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi). Last update [bf2f55b...51a1879](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/96?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).
Supereg commented 5 months ago

Would suggest tagging this as 1.1.0.