https://github.com/pwlkania/pushnotificationsimulation
Helper in simulating push notifications during development
https://github.com/pwlkania/pushnotificationsimulation
apple carthage cocoapods ios mit mit-license mock mocking notification push pushnotification simulation simulator spm swift swift-package-manager swift5 xcode
Last synced: 5 months ago
JSON representation
Helper in simulating push notifications during development
- Host: GitHub
- URL: https://github.com/pwlkania/pushnotificationsimulation
- Owner: pwlkania
- License: mit
- Created: 2019-09-19T09:48:05.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-30T13:14:08.000Z (over 5 years ago)
- Last Synced: 2025-10-10T03:36:52.550Z (5 months ago)
- Topics: apple, carthage, cocoapods, ios, mit, mit-license, mock, mocking, notification, push, pushnotification, simulation, simulator, spm, swift, swift-package-manager, swift5, xcode
- Language: Swift
- Homepage:
- Size: 1.43 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PushNotificationSimulation
`PushNotificationSimulation` helps in simulating push notifications in the application during development.
[](https://swift.org/)
[](https://travis-ci.org/pwlkania/PushNotificationSimulation.svg?branch=master)
[](https://cocoapods.org/pods/PushNotificationSimulation)
[](https://github.com/Carthage/Carthage)
[](https://swift.org/package-manager/)
[](http://cocoadocs.org/docsets/PushNotificationSimulation)
[](https://github.com/pwlkania/PushNotificationSimulation/blob/master/LICENSE)
## Installation
Using [Cocoapods](https://cocoapods.org/) with Podfile:
```ruby
pod 'PushNotificationSimulation'
```
or [Carthage](https://github.com/Carthage/Carthage) and add a line to `Cartfile`:
```ruby
github "pwlkania/PushNotificationSimulation"
```
or [Swift Package Manager](https://github.com/apple/swift-package-manager) (from Xcode 11):
```
File > Swift Packages > Add Package Dependency...
```
and add
```
git@github.com:pwlkania/PushNotificationSimulation.git
```
## Requirements
iOS 11.0
## Initialization
Modify your `AppDelegate.swift` file:
Import `PushNotificationSimulation` framework (if needed):
```swift
import PushNotificationSimulation
```
Implement `PushNotificationSimulation` protocol:
```swift
#if DEBUG
extension AppDelegate: PushNotificationSimulation { }
#endif
```
## Usage
Using breakpoints with debugger command (suggested approach).
Push notification example:
```Swift
sim(payload: "{\"aps\":{\"alert\":{\"title\":\"Game Request\",\"subtitle\":\"Five Card Draw\",\"body\":\"Bob wants to play poker\"},\"category\":\"GAME_INVITATION\"},\"gameID\":\"12345678\"}", delay: 3)
```

Device token example:
```Swift
sim(deviceToken: "933e3112d1eae4a1d8eb48617a265b303be28b300193b9677f0ccf52a63a5b1e")
```

You can also use `sim(payload: ...)` or `sim(deviceToken: ...)` global functions directly in the code. However it might cause issues when code is not deactivated in production version of your application. Be careful.
## License
The project is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).