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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃摎 [Docs] Improve StoreListener documentation #218

Merged
merged 2 commits into from May 6, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .version
@@ -1 +1 @@
6.0.0
6.0.1
4 changes: 3 additions & 1 deletion CHANGELOG.md
@@ -1,7 +1,9 @@
# Changelog

## [6.0.0](https://github.com/BendingSpoons/katana-swift/tree/6.0.0) (2021-04-29)
## [6.0.1](https://github.com/BendingSpoons/katana-swift/tree/6.0.1) (2021-05-06)
- Improve `StoreListener` documentation. [#218](https://github.com/BendingSpoons/katana-swift/pull/218)

## [6.0.0](https://github.com/BendingSpoons/katana-swift/tree/6.0.0) (2021-04-29)
- [BREAKING] Provide old and new state to `StoreListener`s. [#216](https://github.com/BendingSpoons/katana-swift/pull/216)
- Rewrite all tests to use XCTest instead of Quick and Nimble. [#213](https://github.com/BendingSpoons/katana-swift/pull/213)
- Drop Xcake in favour of Tuist. [#213](https://github.com/BendingSpoons/katana-swift/pull/213)
Expand Down
24 changes: 16 additions & 8 deletions Sources/Store.swift
Expand Up @@ -53,8 +53,10 @@ public protocol AnyStore: AnyObject {
func dispatch<T: ReturningSideEffect>(_ dispatchable: T) -> Promise<T.ReturnValue>

/**
Adds a listener to the store. A listener is basically a closure that is invoked
every time the Store's state changes
Adds a listener to the store. A listener is basically a closure that is invoked every time the Store's state changes.

- warning: The listener is always invoked in the main queue, and hence the provided `newState` might be older than the state
accessible with `self.anyState`.

- parameter listener: the listener closure
- returns: a closure that can be used to remove the listener
Expand Down Expand Up @@ -149,8 +151,10 @@ open class PartialStore<S: State>: AnyStore {
}

/**
Adds a listener to the store. A listener is basically a closure that is invoked
every time the Store's state changes
Adds a listener to the store. A listener is basically a closure that is invoked every time the Store's state changes.

- warning: The listener is always invoked in the main queue, and hence the provided `newState` might be older than the state
accessible with `self.state`.

- parameter listener: the listener closure
- returns: a closure that can be used to remove the listener
Expand Down Expand Up @@ -377,8 +381,10 @@ open class Store<S: State, D: SideEffectDependencyContainer>: PartialStore<S> {
}

/**
Adds a listener to the store. A listener is basically a closure that is invoked
every time the Store's state changes. The listener is always invoked in the main queue
Adds a listener to the store. A listener is basically a closure that is invoked every time the Store's state changes.

- warning: The listener is always invoked in the main queue, and hence the provided `newState` might be older than the state
accessible with `self.state`.

- parameter listener: the listener closure
- returns: a closure that can be used to remove the listener
Expand All @@ -390,8 +396,10 @@ open class Store<S: State, D: SideEffectDependencyContainer>: PartialStore<S> {
}

/**
Adds a typed listener to the store. A listener is basically a closure that is invoked
every time the Store's state changes
Adds a typed listener to the store. A listener is basically a closure that is invoked every time the Store's state changes.

- warning: The listener is always invoked in the main queue, and hence the provided `newState` might be older than the state
accessible with `self.state`.

- parameter listener: the listener closure
- returns: a closure that can be used to remove the listener
Expand Down