Instance Method


Called when the active display mode changes.


optional func widgetActiveDisplayModeDidChange(_ activeDisplayMode: NCWidgetDisplayMode, withMaximumSize maxSize: CGSize)



The new active display mode. See NCWidgetDisplayMode for possible values.


A CGSize object that represents the new maximum size this widget can have.


You might implement this method if your widget should change its preferredContentSize value to better accommodate the new display mode.

Widgets displayed as NCWidgetDisplayMode.compact have a fixed size passed in the maxSize parameter.

See Also

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.

enum NCWidgetDisplayMode

The modes that can be toggled between when the user activates the More button for a widget running in iOS.