Skip to content

Commit 3184ca3

Browse files
authored
Merge pull request #14 from trading-point/michael/docs
Change use of `publisher` to `producer`
2 parents 98ef2b3 + c10d876 commit 3184ca3

File tree

17 files changed

+46
-47
lines changed

17 files changed

+46
-47
lines changed

Examples/CaseStudies/SwiftUICaseStudies/02-Effects-LongLiving.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ enum LongLivingEffectsAction {
2828

2929
struct LongLivingEffectsEnvironment {
3030
// An effect that emits Void whenever the user takes a screenshot of the device. We use this
31-
// instead of `NotificationCenter.default.publisher` directly in the reducer so that we can test
32-
// it.
31+
// instead of `NotificationCenter.default.reactive.notifications(forName:)` directly
32+
// in the reducer so that we can test it
3333
var userDidTakeScreenshot: Effect<Void, Never>
3434
}
3535

Examples/CaseStudies/UIKitCaseStudies/CounterViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ final class CounterViewController: UIViewController {
6666
rootStackView.centerYAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.centerYAnchor),
6767
])
6868

69-
self.viewStore.publisher.count
69+
self.viewStore.producer.count
7070
.map(String.init)
7171
.assign(to: \.text, on: countLabel)
7272
}

Examples/CaseStudies/UIKitCaseStudies/ListsOfState.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ final class CountersTableViewController: UITableViewController {
4747

4848
self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: cellIdentifier)
4949

50-
self.viewStore.publisher.counters
50+
self.viewStore.producer.counters
5151
.startWithValues({ [weak self] in self?.dataSource = $0 })
5252
}
5353

Examples/CaseStudies/UIKitCaseStudies/LoadThenNavigate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class LazyNavigationViewController: UIViewController {
8787
rootStackView.centerYAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.centerYAnchor),
8888
])
8989

90-
self.viewStore.publisher.isActivityIndicatorHidden
90+
self.viewStore.producer.isActivityIndicatorHidden
9191
.assign(to: \.isHidden, on: activityIndicator)
9292

9393
self.store

Examples/CaseStudies/UIKitCaseStudies/NavigateAndLoad.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class EagerNavigationViewController: UIViewController {
7979
button.centerYAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.centerYAnchor),
8080
])
8181

82-
self.viewStore.publisher.isNavigationActive.startWithValues { [weak self] isNavigationActive in
82+
self.viewStore.producer.isNavigationActive.startWithValues { [weak self] isNavigationActive in
8383
guard let self = self else { return }
8484
if isNavigationActive {
8585
self.navigationController?.pushViewController(

Examples/TicTacToe/Sources/Views-UIKit/GameViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ public final class GameViewController: UIViewController {
116116
])
117117
}
118118

119-
self.viewStore.publisher.title
119+
self.viewStore.producer.title
120120
.assign(to: \.text, on: titleLabel)
121121

122-
self.viewStore.publisher.isPlayAgainButtonHidden
122+
self.viewStore.producer.isPlayAgainButtonHidden
123123
.assign(to: \.isHidden, on: playAgainButton)
124124

125-
self.viewStore.publisher.producer.map { ($0.board, $0.isGameEnabled) }
125+
self.viewStore.producer.producer.map { ($0.board, $0.isGameEnabled) }
126126
.skipRepeats(==)
127127
.startWithValues { board, isGameEnabled in
128128
board.enumerated().forEach { rowIdx, row in

Examples/TicTacToe/Sources/Views-UIKit/LoginViewController.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,25 @@ class LoginViewController: UIViewController {
105105
divider.heightAnchor.constraint(equalToConstant: 1),
106106
])
107107

108-
self.viewStore.publisher.isLoginButtonEnabled
108+
self.viewStore.producer.isLoginButtonEnabled
109109
.assign(to: \.isEnabled, on: loginButton)
110110

111-
self.viewStore.publisher.email
111+
self.viewStore.producer.email
112112
.assign(to: \.text, on: emailTextField)
113113

114-
self.viewStore.publisher.isEmailTextFieldEnabled
114+
self.viewStore.producer.isEmailTextFieldEnabled
115115
.assign(to: \.isEnabled, on: emailTextField)
116116

117-
self.viewStore.publisher.password
117+
self.viewStore.producer.password
118118
.assign(to: \.text, on: passwordTextField)
119119

120-
self.viewStore.publisher.isPasswordTextFieldEnabled
120+
self.viewStore.producer.isPasswordTextFieldEnabled
121121
.assign(to: \.isEnabled, on: passwordTextField)
122122

123-
self.viewStore.publisher.isActivityIndicatorHidden
123+
self.viewStore.producer.isActivityIndicatorHidden
124124
.assign(to: \.isHidden, on: activityIndicator)
125125

126-
self.viewStore.publisher.alert
126+
self.viewStore.producer.alert
127127
.startWithValues { [weak self] alert in
128128
guard let self = self else { return }
129129
guard let alert = alert else { return }

Examples/TicTacToe/Sources/Views-UIKit/NewGameViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ class NewGameViewController: UIViewController {
101101
rootStackView.centerYAnchor.constraint(equalTo: self.view.centerYAnchor),
102102
])
103103

104-
self.viewStore.publisher.isLetsPlayButtonEnabled
104+
self.viewStore.producer.isLetsPlayButtonEnabled
105105
.assign(to: \.isEnabled, on: letsPlayButton)
106106

107-
self.viewStore.publisher.oPlayerName
107+
self.viewStore.producer.oPlayerName
108108
.assign(to: \.text, on: playerOTextField)
109109

110-
self.viewStore.publisher.xPlayerName
110+
self.viewStore.producer.xPlayerName
111111
.assign(to: \.text, on: playerXTextField)
112112

113113
self.store

Examples/TicTacToe/Sources/Views-UIKit/TwoFactorViewController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,16 @@ public final class TwoFactorViewController: UIViewController {
7373
rootStackView.centerYAnchor.constraint(equalTo: self.view.centerYAnchor),
7474
])
7575

76-
self.viewStore.publisher.isActivityIndicatorHidden
76+
self.viewStore.producer.isActivityIndicatorHidden
7777
.assign(to: \.isHidden, on: activityIndicator)
7878

79-
self.viewStore.publisher.code
79+
self.viewStore.producer.code
8080
.assign(to: \.text, on: codeTextField)
8181

82-
self.viewStore.publisher.isLoginButtonEnabled
82+
self.viewStore.producer.isLoginButtonEnabled
8383
.assign(to: \.isEnabled, on: loginButton)
8484

85-
self.viewStore.publisher.alert
85+
self.viewStore.producer.alert
8686
.startWithValues { [weak self] alert in
8787
guard let self = self else { return }
8888
guard let alert = alert else { return }

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,11 @@ It is also straightforward to have a UIKit controller driven off of this store.
225225

226226
// Omitted: Add subviews and set up constraints...
227227

228-
self.viewStore.publisher
228+
self.viewStore.producer
229229
.map(String.init)
230230
.assign(to: \.text, on: countLabel)
231231

232-
self.viewStore.publisher.numberFactAlert
232+
self.viewStore.producer.numberFactAlert
233233
.startWithValues { [weak self] numberFactAlert in
234234
let alertController = UIAlertController(
235235
title: numberFactAlert, message: nil, preferredStyle: .alert
@@ -381,7 +381,7 @@ If you are interested in contributing a wrapper library for a framework that we
381381

382382
In some ways TCA is a little more opinionated than the other libraries. For example, Redux is not prescriptive with how one executes side effects, but TCA requires all side effects to be modeled in the `Effect` type and returned from the reducer.
383383

384-
In other ways TCA is a little more lax than the other libraries. For example, Elm controls what kinds of effects can be created via the `Cmd` type, but TCA allows an escape hatch to any kind of effect since `Effect` conforms to the Combine `Publisher` protocol.
384+
In other ways TCA is a little more lax than the other libraries. For example, Elm controls what kinds of effects can be created via the `Cmd` type, but TCA allows an escape hatch to any kind of effect since `Effect` is just a ReactiveSwift `SignalProducer`.
385385

386386
And then there are certain things that TCA prioritizes highly that are not points of focus for Redux, Elm, or most other libraries. For example, composition is very important aspect of TCA, which is the process of breaking down large features into smaller units that can be glued together. This is accomplished with the `pullback` and `combine` operators on reducers, and it aids in handling complex features as well as modularization for a better-isolated code base and improved compile times.
387387
</details>

0 commit comments

Comments
 (0)