---
title: "widgetActiveDisplayModeDidChange(_:withMaximumSize:)"
framework: notificationcenter
role: symbol
role_heading: Instance Method
path: "notificationcenter/ncwidgetproviding/widgetactivedisplaymodedidchange(_:withmaximumsize:)"
---

# widgetActiveDisplayModeDidChange(_:withMaximumSize:)

Called when the active display mode changes.

## Declaration

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

## Parameters

- `activeDisplayMode`: The new active display mode. See doc://com.apple.notificationcenter/documentation/NotificationCenter/NCWidgetDisplayMode for possible values.
- `maxSize`: A doc://com.apple.documentation/documentation/CoreFoundation/CGSize object that represents the new maximum size this widget can have.

## Discussion

Discussion 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

- [widgetMarginInsets(forProposedMarginInsets:)](notificationcenter/ncwidgetproviding/widgetmargininsets(forproposedmargininsets:).md)
- [NCWidgetDisplayMode](notificationcenter/ncwidgetdisplaymode.md)
