<!--
{
  "availability" : [
    "iOS: 8.0.0 - 14.0.0",
    "iPadOS: 8.0.0 - 14.0.0",
    "macCatalyst: 8.0.0 - 14.0.0",
    "macOS: 10.10.0 - 11.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "NotificationCenter",
  "identifier" : "/documentation/NotificationCenter/NCWidgetController/setHasContent(_:forWidgetWithBundleIdentifier:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Notification Center"
    ],
    "preciseIdentifier" : "c:objc(cs)NCWidgetController(im)setHasContent:forWidgetWithBundleIdentifier:"
  },
  "title" : "setHasContent(_:forWidgetWithBundleIdentifier:)"
}
-->

# setHasContent(_:forWidgetWithBundleIdentifier:)

Sets whether the specified widget has content to display.

```
func setHasContent(_ flag: Bool, forWidgetWithBundleIdentifier bundleID: String)
```

## Parameters

`flag`

Indicates whether the widget has content to display. Default value is <doc://com.apple.documentation/documentation/Swift/true>.

`bundleID`

The bundle identifier of the widget.

## Discussion

Both a widget and its containing app can use this method to specify whether the widget has content to display. The value of `flag` determines whether a widget should be visible in the Today view and whether the widget’s most recent snapshot is still valid.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)