iosswifttoday-extensionurlsession

Can I call a func in my containing app from by iOS Today Widget?


I have a swift music app that plays content from streaming providers on speakers.

The main app makes all the network calls and takes advantage of background audio to enable lock screen control.

I now have a Today Extension, I have setup app groups and use userdefaults to share metadata. I currently run urlsessions within the extension code to activate play/pause/skip/volume,etc... but this will not update the background audio or lock screen controls. It also seems inefficient.

Is there a way to run a function in my main app by pressing a button on the widget?

Thanks, Paul


Solution

  • Please checkout this link it will help you

    Perform action in host app from Today extension(Widget) Without opening app ios