The NCWidgetProviding protocol lets you customize some of the appearance and behavior of a widget (a widget is an app extension).


protocol NCWidgetProviding


Customizing the Display

func widgetMarginInsets(forProposedMarginInsets: UIEdgeInsets) -> UIEdgeInsets

Called to let a widget accept the default margin inset values or return custom values to use instead.

Updating a Widget’s Contents

func widgetPerformUpdate(completionHandler: (NCUpdateResult) -> Void)

Called to give a widget an opportunity to update its contents.

Supporting Editing

var widgetAllowsEditing: Bool

A Boolean value indicating whether the widget can be edited by users.

func widgetDidBeginEditing()

Called when a user chooses the widget’s begin editing button.

func widgetDidEndEditing()

Called when a widget’s editing session ends.


enum NCUpdateResult

Specifies the possible results of updating a widget’s state.