Framework

NotificationCenter

Create and manage widgets.

Overview

The Notification Center framework helps you create and manage app extensions that implement widgets. The framework provides an API you can use to specify whether a widget has content to display, and to customize aspects of its appearance and behavior. To learn more about creating a widget app extension, see App Extension Programming Guide.

In macOS, the Notification Center framework provides ways to customize the editing and searching experience in a widget.

Topics

Classes

class NCWidgetController

The NCWidgetController class defines an object that both a widget (that is, a Today extension) and the app that delivers the widget (called the containing app) can use to specify whether the widget has content to display. Because this class helps a widget and its containing app coordinate the display of the widget’s content, a widget that doesn’t communicate with its containing app is unlikely to use this class.

class NCWidgetListViewController

The NCWidgetListViewController class provides a list view for displaying content in a Today widget (a widget is an extension in the Today view of Notification Center). A list view controller works together with its delegate to display content and support user interaction with the list. To learn about the list view controller delegate methods, see NCWidgetListViewDelegate.

class NCWidgetSearchViewController

The NCWidgetSearchViewController class provides a default search view within a widget (a widget is an extension in the Today view of Notification Center). A search view controller works together with its delegate to perform searches on the user’s input and display results from which a user can choose. To learn about the search view controller delegate methods, see NCWidgetSearchViewDelegate.

Protocols

protocol NCWidgetListViewDelegate

The NCWidgetListViewDelegate protocol defines methods that handle content display and editing in the list view of a Today widget (a widget is an extension in the Today view of Notification Center). The delegate of an NCWidgetListViewController must adopt the NCWidgetListViewDelegate protocol.

protocol NCWidgetProviding

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

protocol NCWidgetSearchViewDelegate

The NCWidgetSearchViewDelegate protocol defines methods that enable user searches in the search view controller of a widget (a widget is an extension in the Today view of Notification Center). The delegate of an NCWidgetSearchViewController must adopt the NCWidgetSearchViewDelegate protocol.

Reference

Notification Center Constants

This document describes the constants in the Notification Center framework.