https://github.com/npvisual/applifecyclemiddleware
Middleware that reacts to an Application's lifecycle
https://github.com/npvisual/applifecyclemiddleware
Last synced: 5 months ago
JSON representation
Middleware that reacts to an Application's lifecycle
- Host: GitHub
- URL: https://github.com/npvisual/applifecyclemiddleware
- Owner: npvisual
- Created: 2020-10-07T19:47:18.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-11-23T13:25:18.000Z (over 4 years ago)
- Last Synced: 2025-01-23T05:31:17.883Z (over 1 year ago)
- Language: Swift
- Size: 41 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AppLifecycleMiddleware
This is a [SwiftRex Middleware](https://github.com/SwiftRex/SwiftRex#middleware) that specializes in transforming application lifecycle notification to Redux actions.
The original code was pulled from [@luizmb](https://github.com/luizmb)'s code and extracted to avoid copying it over and over. In addition the code was refactored to allow to mock some of the notifications provided by the [`NotificationCenter`](https://developer.apple.com/documentation/foundation/notificationcenter) (via dependency injection).
## Current features
We currently support the following notifications :
- [`didBecomeActiveNotification`](https://developer.apple.com/documentation/uikit/uiapplication/1622953-didbecomeactivenotification)
- [`willResignActiveNotification`](https://developer.apple.com/documentation/uikit/uiapplication/1622973-willresignactivenotification)
- [`didEnterBackgroundNotification`](https://developer.apple.com/documentation/uikit/uiapplication/1623071-didenterbackgroundnotification)
- [`willEnterForegroundNotification`](https://developer.apple.com/documentation/uikit/uiapplication/1622944-willenterforegroundnotification)
## Future enhancements
Looking at supporting those additional notifications :
- [`willTerminateNotification`](https://developer.apple.com/documentation/uikit/uiapplication/1623061-willterminatenotification)