PushNotificationSimulation 1.1.2

PushNotificationSimulation 1.1.2

Maintained by Paweł Kania, Pawel Kania.



  • By
  • Paweł Kania

PushNotificationSimulation

PushNotificationSimulation helps in simulating push notifications in the application during development.

Swift 5.0 Travis CocoaPods Compatible Carthage Compatible SPM Platform License

Installation

Using Cocoapods with Podfile:

pod 'PushNotificationSimulation'

or Carthage and add a line to Cartfile:

github "pwlkania/PushNotificationSimulation"

or Swift Package Manager (from Xcode 11):

File > Swift Packages > Add Package Dependency...

and add

[email protected]:pwlkania/PushNotificationSimulation.git

Requirements

iOS 11.0

Initialization

Modify your AppDelegate.swift file:

Import PushNotificationSimulation framework (if needed):

import PushNotificationSimulation

Implement PushNotificationSimulation protocol:

#if DEBUG
extension AppDelegate: PushNotificationSimulation { }
#endif

Usage

Using breakpoints with debugger command (suggested approach).

Push notification example:

sim(payload: "{\"aps\":{\"alert\":{\"title\":\"Game Request\",\"subtitle\":\"Five Card Draw\",\"body\":\"Bob wants to play poker\"},\"category\":\"GAME_INVITATION\"},\"gameID\":\"12345678\"}", delay: 3)

Payload.png

Device token example:

sim(deviceToken: "933e3112d1eae4a1d8eb48617a265b303be28b300193b9677f0ccf52a63a5b1e")

DeviceToken.png

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.