Skip to content

Commit eb3b08c

Browse files
authored
Merge pull request #8 from rogerkislig/feature/middleware
added loggingmiddleware
2 parents 8a0e0b9 + 29c4fa7 commit eb3b08c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

CounterExample/AppDelegate.swift

+14-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,22 @@ import ReSwift
1212
// The global application store, which is responsible for managing the appliction state.
1313
let mainStore = Store<AppState>(
1414
reducer: CounterReducer(),
15-
state: nil
15+
state: nil,
16+
middleware: [loggingMiddleware]
1617
)
1718

19+
20+
let loggingMiddleware: Middleware = { dispatch, getState in
21+
return { next in
22+
return { action in
23+
24+
print(action)
25+
26+
return next(action)
27+
}
28+
}
29+
}
30+
1831
@UIApplicationMain
1932
class AppDelegate: UIResponder, UIApplicationDelegate {
2033

0 commit comments

Comments
 (0)