Contents

printContent(_:)

Tells your app to print available content.

Declaration

optional func printContent(_ sender: Any?)

Parameters

  • sender:

    The object calling this method.

Discussion

Implement this method on the responder responsible for printing the contents of the window scene; for instance, the root view controller of a UIWindow. In your implementation, prepare the print job and present an instance of UIPrintInteractionController to show a Print dialog.

If your app includes the UIApplicationSupportsPrintCommand key in its Info.plist file, people can print from your app using the keyboard shortcut Command-P, which calls printContent(_:). You can also set printContent(_:) as the action on other print-related controls such as a print button on a toolbar.

For more information about printing from your app, see Printing.