Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ShinryakuTako committed Nov 18, 2019
1 parent 6e863bc commit d776f7e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Documentation/Tips & Troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ permalink: documentation/tips.html

1. [Common Mistakes](#common-mistakes)
2. [Best Practices](#best-practices)
3. [Tips & Tricks](#tips-&-tricks)
4. [Pitfalls & Gotchas](#pitfalls-&-gotchas)
5. [Conditional Compilation Flags & Debugging Aids](#conditional-compilation-flags-&-debugging-aids)
3. [Tips & Tricks](#tips--tricks)
4. [Pitfalls & Gotchas](#pitfalls--gotchas)
5. [Conditional Compilation Flags & Debugging Aids](#conditional-compilation-flags--debugging-aids)

* 🚀 **To quickly start using OctopusKit with a template project, see [QuickStart.][quickstart]**

Expand Down
20 changes: 10 additions & 10 deletions Documentation/Usage Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ redirect_from: "/Documentation/Usage%2Guide.html"
1. [Start](#start)
2. [Player Input](#player-input)
3. [Accessing Game State From SwiftUI Views](#accessing-game-state-from-swiftui-views)
3. [Accessing Game State from SwiftUI Views](#accessing-game-state-from-swiftui-views)
3. [Global Data](#global-data)

##### Other Documents
Expand Down Expand Up @@ -155,7 +155,7 @@ yourPlayerEntity.addComponents([
## Accessing Game State from SwiftUI Views

```swift
class GlobalDataComponent: OctopusComponent, ObservableObject {
class DataComponent: OctopusComponent, ObservableObject {

@Published public var secondsElapsed: TimeInterval = 0

Expand All @@ -164,35 +164,35 @@ class GlobalDataComponent: OctopusComponent, ObservableObject {
}
}

struct GlobalDataComponentLabel: View {
struct DataComponentLabel: View {

@ObservedObject var component: GlobalDataComponent
@ObservedObject var component: DataComponent

var body: some View {
Text("Seconds since activation: \(component.secondsElapsed)")
Text("Seconds elapsed: \(component.secondsElapsed)")
}
}
```

In a container view, pass the component as an argument to the label view:

```swift
var globalDataComponent: GlobalDataComponent? {
gameCoordinator.entity[GlobalDataComponent.self]
var globalDataComponent: DataComponent? {
gameCoordinator.entity[DataComponent.self]
}

var body: some View {
if globalDataComponent != nil {
GlobalDataComponentLabel(component: globalDataComponent!)
DataComponentLabel(component: globalDataComponent!)
}
}
```

💡 You may write a custom property wrapper like say `@Component` to simplify accessing components.
💡 You may write a custom property wrapper like say `@Component` to simplify accessing components from the current scene etc.

## Global Data

> TODO: Sharing "global" data via `RelayComponent`s
> TODO: Sharing "global" data via `RelayComponent`
----

Expand Down
4 changes: 2 additions & 2 deletions QuickStart/README QuickStart.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
> 🏷 Filenames are prefixed with a number denoting the order they come in during the application's life cycle.
> 🔍 Search for comments prefixed with "STEP #" for a quick overview of the flow of execution.
> 🔍 Search for comments prefixed with `STEP #` for a quick overview of the flow of execution.
> 💡 Try out different components from the `Sources/OctopusKit/Components` folder.
7. Check the documentation:
* For a detailed explanation of the engine architecture, see the [Architecture.md][architecture] file in the `Documentation` folder of the OctopusKit package/repository.
* For a detailed explanation of the engine architecture, see [Architecture.md][architecture] in the `Documentation` folder of the OctopusKit package/repository.
* **To see how to do common tasks, refer to [Usage Guide.md][guide]**
Expand Down

0 comments on commit d776f7e

Please sign in to comment.