2

I am new with XCode and iOS development.

What we need to do: We need to create widget that will have button on it. This button must be clickable and when clicking on it, some action should be triggered. (For our particular case, we need to start recording form device microphone)

What we have done: We have created iOS application, added widget extension and we are able to communicate small string between main app and widget. I have searched on internet, also went trough following question: ios-add-button-to-widget-extension I have also found following topic: How to add Buttons to a Widget but i am struggling to have a clear idea.

How can i add clickable button to iOS widget?

Thanks

Tornike Shavishvili
  • 1,244
  • 4
  • 16
  • 35

1 Answers1

2

This is possible, but there are some limitations.

  1. You can't just execute code, you can only deeplink to your app which then handles the click.
  2. systemSmall widget is treated as one clickable area (no granular control over multiple touch targets)
  3. systemMedium and systemLarge can have more touch targets and use Link to deeplink to your app with a specific action.

To see an example of how this can be done, you can refer to this post.

Kyle Venn
  • 4,597
  • 27
  • 41