Skip to content

Commit

Permalink
Fix Standard documentation page (#92)
Browse files Browse the repository at this point in the history
# Fix Standard documentation page

## ♻️ Current situation & Problem
This PR addresses some issues in outdated documentation. 


## ⚙️ Release Notes 
* Improved documentation.


## 📚 Documentation
--


## ✅ Testing
--


## 📝 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
Supereg authored Nov 11, 2023
1 parent b82fb37 commit 092eabc
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Sources/Spezi/Spezi.docc/Standard.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@ protocol ExampleConstraint: Standard {
}
```

You will have to define your own ``Standard`` type or use a predefined one that either conforms to all requirements or is extended to support these requirements using Swift extensions if your application uses any modules that enforce constraints on the ``Standard`` instance.
You will have to define your own ``Standard`` type or use a predefined one that either conforms to all requirements or is extended to support these requirements
using Swift extensions if your application uses any modules that enforce constraints on the ``Standard`` instance.

#### 1. Standard Conformance
> Tip: You can always access the current ``Standard`` instance in your ``Module`` using the ``Module/StandardActor`` property wrapper.
It is also available using the [Environment](https://developer.apple.com/documentation/swiftui/environment)
property wrapper in your SwiftUI views, when you declare conformance to ``EnvironmentAccessible``.

The `Standard` defined in the `Configuration` must conform to all constraints defined by `Modules` using their `@StandardActor`s, or you need to write an extension to an existing `Standard` that you use to implement the conformance.
#### Standard Conformance

The `Standard` defined in the `Configuration` must conform to all constraints defined by `Modules` using their `@StandardActor`s,
or you need to write an extension to an existing `Standard` that you use to implement the conformance.

If you define your own standard, you can define the conformance and complete implementation in your code:
```swift
Expand All @@ -45,7 +51,7 @@ extension ExistingStandard: ExampleConstraint {
}
```

#### 2. Standard Definition
#### Standard Definition

The standard as well as all modules, are defined using the ``Configuration`` in the app delegate conforming to ``SpeziAppDelegate``.
Ensure that you define an appropriate standard in your configuration in your `SpeziAppDelegate` subclass:
Expand All @@ -59,6 +65,3 @@ var configuration: Configuration {
```

> Note: You can learn more about setting up your application in the <doc:Initial-Setup> article. You can learn more about the ``Configuration`` in its type documentation.
You can always access the current ``Standard`` instance in your ``Module`` using the @``Module/StandardActor`` property wrapper.
It is also available using the `@EnvironmentObject` property wrapper in your SwiftUI views.

0 comments on commit 092eabc

Please sign in to comment.