Skip to content
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

Introduce EnvironmentAccessible #89

Merged
merged 1 commit into from
Nov 7, 2023
Merged

Conversation

Supereg
Copy link
Member

@Supereg Supereg commented Nov 7, 2023

Introduce EnvironmentAccessible

♻️ Current situation & Problem

As of right now, it is not easy to access a Component directly within your SwiftUI views. This approach is, e.g., used within SpeziStorage to make its API easy accessible.
We introduce the EnvironmentAccessible protocol that allows a Module to be accessed from the environment just like an Observable. Further, we optimized @Modifier and @Model to allow for later initialization.

⚙️ Release Notes

  • Introduce EnvironmentAccessible protocol.
  • Allow for delayed initialization of @Modifier and @Model.

📚 Documentation

  • Documentation was added.

✅ Testing

New functionality was tested.

📝 Code of Conduct & Contributing Guidelines

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

@Supereg Supereg marked this pull request as ready for review November 7, 2023 01:28
@Supereg Supereg requested a review from PSchmiedmayer November 7, 2023 01:28
Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Merging #89 (c408115) into main (3c0a44e) will decrease coverage by 0.82%.
The diff coverage is 60.61%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #89      +/-   ##
==========================================
- Coverage   95.49%   94.67%   -0.82%     
==========================================
  Files          36       37       +1     
  Lines         665      693      +28     
==========================================
+ Hits          635      656      +21     
- Misses         30       37       +7     
Files Coverage Δ
...apabilities/Observable/EnvironmentAccessible.swift 100.00% <100.00%> (ø)
...pabilities/ViewModifier/ViewModifierProvider.swift 100.00% <100.00%> (ø)
Sources/Spezi/Spezi/Spezi.swift 95.24% <100.00%> (+0.65%) ⬆️
...ilities/ViewModifier/ModifierPropertyWrapper.swift 68.00% <50.00%> (+14.67%) ⬆️
...Capabilities/Observable/ModelPropertyWrapper.swift 53.58% <41.67%> (-7.53%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3c0a44e...c408115. Read the comment docs.

@Supereg
Copy link
Member Author

Supereg commented Nov 7, 2023

@PSchmiedmayer feel free to merge, once reviewed. Diff coverage is of due to the error state handling having high impact on the overall little diff

Copy link
Member

@PSchmiedmayer PSchmiedmayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you.

Would be great if we get an issue in place to improve the Module documentation in general and structure it as discussed in the office 👍

@PSchmiedmayer PSchmiedmayer merged commit 13f72bf into main Nov 7, 2023
@PSchmiedmayer PSchmiedmayer deleted the feature/optimize-observable branch November 7, 2023 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants