Skip to content

Commit

Permalink
Update usage-overview.md
Browse files Browse the repository at this point in the history
  • Loading branch information
0xLeif authored Sep 24, 2024
1 parent 1d09444 commit 96f54e3
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions documentation/usage-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,31 +105,6 @@ print(username) // Prints "New Username"

This example demonstrates how to access and modify a specific slice of application state.

## Publisher and Subscribing

`Publisher` allows objects to subscribe to changes in state or data. Subscribers are notified whenever the publisher's data changes.

### Example

```swift
import AppState

class MySubscriber: Subscribing {
typealias Value = String

func didUpdate(newValue: String?) {
print("New value: \(String(describing: newValue))")
}
}

let subscriber = MySubscriber()
let publisher = Publisher(initialValue: "Initial value", subscribers: [subscriber])

publisher.value = "Updated value" // Prints "New value: Updated value"
```

This example shows how to create a reactive system where objects respond to state changes.

## Next Steps

For more in-depth details on each component, refer to the specific usage guides:
Expand Down

0 comments on commit 96f54e3

Please sign in to comment.