StanfordSpezi / SpeziViews

A common set of SwiftUI views and related functionality used in Spezi modules
https://swiftpackageindex.com/StanfordSpezi/SpeziViews/documentation/
MIT License
4 stars 3 forks source link

Map Operation States to View States #24

Closed philippzagar closed 10 months ago

philippzagar commented 10 months ago

Map Operation States to View States

:recycle: Current situation & Problem

As developers within the Spezi framework and those building upon the Spezi ecosystem, we encounter a recurring problem in state management. Our workflow involves translating operational states — such as those from a Language Model or Download process, which often have defined beginning and end states — into a ViewState from SpeziViews which includes robust error handling handled through alterts, without defined start or end states (the mental model differs here). Currently, the procedure for this state transition is overly intricate and imperatively structured. We recognize the need for a more streamlined, declaratively designed solution that better complements the Spezi framework's ethos.

:gear: Release Notes

:books: Documentation

In-line documentation and examples.

:white_check_mark: Testing

Added adequate UI Tests.

: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 10 months ago

Codecov Report

Merging #24 (b3e7f2c) into main (eac4430) will increase coverage by 0.46%. The diff coverage is 100.00%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/StanfordSpezi/SpeziViews/pull/24/graphs/tree.svg?width=650&height=150&src=pr&token=7UbLX71dAO&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi)](https://app.codecov.io/gh/StanfordSpezi/SpeziViews/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) ```diff @@ Coverage Diff @@ ## main #24 +/- ## ========================================== + Coverage 77.74% 78.20% +0.46% ========================================== Files 34 36 +2 Lines 1069 1096 +27 ========================================== + Hits 831 857 +26 - Misses 238 239 +1 ``` | [Files](https://app.codecov.io/gh/StanfordSpezi/SpeziViews/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) | Coverage Δ | | |---|---|---| | [...s/ViewModifier/ViewState/OperationStateAlert.swift](https://app.codecov.io/gh/StanfordSpezi/SpeziViews/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aVZpZXdzL1ZpZXdNb2RpZmllci9WaWV3U3RhdGUvT3BlcmF0aW9uU3RhdGVBbGVydC5zd2lmdA==) | `100.00% <100.00%> (ø)` | | | [...iViews/ViewModifier/ViewState/ViewStateAlert.swift](https://app.codecov.io/gh/StanfordSpezi/SpeziViews/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aVZpZXdzL1ZpZXdNb2RpZmllci9WaWV3U3RhdGUvVmlld1N0YXRlQWxlcnQuc3dpZnQ=) | `100.00% <ø> (ø)` | | | [...Views/ViewModifier/ViewState/ViewStateMapper.swift](https://app.codecov.io/gh/StanfordSpezi/SpeziViews/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aVZpZXdzL1ZpZXdNb2RpZmllci9WaWV3U3RhdGUvVmlld1N0YXRlTWFwcGVyLnN3aWZ0) | `100.00% <100.00%> (ø)` | | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/StanfordSpezi/SpeziViews/pull/24/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/StanfordSpezi/SpeziViews/pull/24?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/SpeziViews/pull/24?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi). Last update [eac4430...b3e7f2c](https://app.codecov.io/gh/StanfordSpezi/SpeziViews/pull/24?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).
philippzagar commented 10 months ago

Left my initial thoughts for now. Feel free to share your views. Great work 🚀

Thanks for all the input regarding the implementation!