Daniel Tovesson
Daniel Tovesson

Reputation: 2600

How to send message from widget to iOS app

I'm implementing a widget extension with 3 buttons. These buttons are meant to trigger a method in my iOS app. Is this possible? I know you can share data with UserDefaults but I want to trigger a function right from the widget.

Upvotes: 2

Views: 505

Answers (1)

Nikos M.
Nikos M.

Reputation: 13783

The best way to do it (and the way Apple suggests) is to create an embedded framework with all the common code and methods you need your main app and your widget to share and import that framework to both targets.

Upvotes: 2

Related Questions