Integrate MPush

To integrate MPush to your implementation you need to add this in your AppDelegate

import MPushSwift

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    ...
    MPush.token = "YOUR_PUSH_TOKEN"
    ...
}

...

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    MPush.registerDevice(deviceToken: deviceToken, success: {
        MPush.register(toTopic: "YOUR_TOPIC")
        // OR if you have more than one topic
        // MPush.register(toTopics: ["TOPIC1", "TOPIC2"])
    })
}

You're set 🎉, the device will receive notifications for the topic is registered to.

Last updated