NotificationCenter response using Fuse with iOS

Hello -

I am very new to Fuse and slightly less new to Swift/iOS. I am trying to use a Framework I developed in Swift in a current Fuse project. I followed a tutorial I found: https://github.com/YugoCode/SwiftFuse#swiftfuse to wrap my Framework in an Objective-C manner and can call the function that “starts” my Framework.

The next step in the problem is getting data to flow from my Framework into my Fuse app. In my Swift example I am using the NotificationCenter by doing something like:

NotificationCenter.default.addObserver(self, selector: #selector(self.notificationReceived(_:)), name: Notification.Name.myKey, object: nil)

And then I have a function where I listen for notifications:

func notificationReceived(_ notification: Notification) {
    guard let text = notification.userInfo?["my_data"] as? String else { return }
    if(text == "running"){
        // respond to running 
    }
}

Are there any resources/tutorials you can point me towards that would allow me to accomplish the same thing in Fuse? I did see the tutorial on fuse Local Notifications, but it wasn’t clear to me how I’d tune into the notifications being generated by my local Framework.

Thanks!

Hi Jason,

you could look into how PushNotifications and LocalNotifications are implemented in fuselibs.

Hope this helps!