Simplify LicensesView documentation pattern
This commit is contained in:
parent
9a0ebe2f55
commit
7c04a25fc2
@ -493,13 +493,14 @@ SettingsNavigationRow(
|
|||||||
|
|
||||||
A reusable view for displaying open source licenses used in your app.
|
A reusable view for displaying open source licenses used in your app.
|
||||||
|
|
||||||
**Step 1: Define licenses in your app**
|
**Create an app-specific wrapper view with licenses**
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
|
import SwiftUI
|
||||||
import Bedrock
|
import Bedrock
|
||||||
|
|
||||||
extension License {
|
struct AppLicensesView: View {
|
||||||
static let appLicenses: [License] = [
|
private static let licenses: [License] = [
|
||||||
License(
|
License(
|
||||||
name: "MijickCamera",
|
name: "MijickCamera",
|
||||||
url: "https://github.com/Mijick/Camera",
|
url: "https://github.com/Mijick/Camera",
|
||||||
@ -513,16 +514,10 @@ extension License {
|
|||||||
description: "In-app subscriptions made easy."
|
description: "In-app subscriptions made easy."
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**Step 2: Create app-specific wrapper view**
|
|
||||||
|
|
||||||
```swift
|
|
||||||
struct AppLicensesView: View {
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
LicensesView(
|
LicensesView(
|
||||||
licenses: License.appLicenses,
|
licenses: Self.licenses,
|
||||||
backgroundColor: AppSurface.overlay,
|
backgroundColor: AppSurface.overlay,
|
||||||
cardBackgroundColor: AppSurface.card,
|
cardBackgroundColor: AppSurface.card,
|
||||||
cardBorderColor: AppBorder.subtle,
|
cardBorderColor: AppBorder.subtle,
|
||||||
@ -532,7 +527,7 @@ struct AppLicensesView: View {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**Step 3: Navigate to it from settings**
|
**Navigate to it from settings**
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
SettingsNavigationRow(
|
SettingsNavigationRow(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user