Skip to content

Commit 37cb56a

Browse files
authored
Update README.md
1 parent 8bb39ca commit 37cb56a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ The iOS workspace in `/iOS/NameGame` can be open and ran from xCode or AppCode.
3030

3131
## Architecture
3232

33-
A `GameEngine` object holds the state of the app and provides a methods for views (fragments/UIViewControllers) to "attach". The `GameEngine` is initialized in the Application class on Android, and the AppDelegate on iOS. Each view must attach/detach from the GameEngine when it is visible. `GameEngine.attachView(view)` returns the appropriate presenter for the view.
33+
A `GameEngine` object holds the state of the app in a redux store and provides a methods for views (fragments/UIViewControllers) to "attach". The `GameEngine` is initialized in the Application class on Android, and the AppDelegate on iOS. Each view must attach/detach from the GameEngine when it is visible. `GameEngine.attachView(view)` returns the appropriate presenter for the view.
3434

3535
`BaseNameGameViewFragment` & `BaseNameGameViewController` handle attaching/detaching the presenter at the appropriate lifecycle methods. Each Fragment/ViewController extends from these.
3636

37-
An MVP arch is used with a redux store as the 'Model'. This approach allows maximum reuse of code and a simple contract for the platforms to satisfy. Presenters send `ViewStates` (simple data classes with fields needed to render UI) to the View interface. The View implementation has a reference to the presenter, and calls methods for user interaction. This creates a unidirectional dataflow:
37+
An MVP arch is used with a redux store as the 'Model'. This approach allows maximum reuse of code and a simple contract for the platforms to satisfy. Presenters send `ViewStates` (simple data classes with fields needed to render UI) to the View interface. The View implementation has a reference to the presenter, and calls methods on the presetner for user interaction. This creates a unidirectional dataflow:
3838

3939
User interaction -> Dispatch Action -> new state (reduce) -> view rendered by presenter
4040

@@ -46,7 +46,7 @@ Views in this arch are truely 'dumb' - they should contain nearly no logic. The
4646
![](https://storage.googleapis.com/treestorage/ui_f_of_state.png)
4747

4848

49-
Presenters give a layer of control between subscribing to the new state and the View. Having views subscribing directly to the store results in code and logic in the View which must be duplicated on each platform. Presenters are singleton objects that contain no state other than the previous AppState. This works while presenters are for an entire screen, which for this app is the case. Another approach will be needed if multiple instances of a given presenter are needed. The presenter is responsible for rendering the view given the AppState or the delta in AppState. The Reduks library has a port of Reselect, which allows calling code only when a property changes. Presenters pass `ViewState` to View methods. All transformations from Appstate -> ViewState are extension functions in `Transformations.kt`.
49+
Presenters give a layer of control between subscribing to the new state and the View. Views subscribing directly to the store results in code and logic in the View which must be duplicated on each platform. Presenters are singleton objects that contain no state other than the previous AppState. This works while presenters are for an entire screen, which for this app is the case. Another approach will be needed if multiple instances of a given presenter are needed. The presenter is responsible for rendering the view given the AppState or the delta in AppState. The Reduks library has a port of Reselect, which allows calling code only when a property changes. Presenters pass `ViewState` to View methods. All transformations from Appstate -> ViewState are extension functions in `Transformations.kt`.
5050

5151

5252

0 commit comments

Comments
 (0)