A model class that describes the view elements to be added to the main toolbar.

This API allows you to specify a button. Usage:

let customItem = OrnamentItem(kind: .button(configuration: .init(title: "Custom Item Title", image: UIImage(named: "abc"),
    action: { sender in
    // perform custom action here on ornament item tap.
}, showTitle: true, isHighlightable: true)))

You can also create an item that will act as the title for the main toolbar. The item will have to be created using OrnamentItem.Kind.title that takes a closure returning a string as an associated value. The string returned from the closure is used as the text for the title item. Usage:

let titleItem = OrnamentItem(kind: .title(provider: { getMyCustomTitle() }))

Divider item is as simple a it sounds which will add a horizontal divider. Usage:

let divider = OrnamentItem(kind: .divider)

see PDFViewController.setMainToolbarOrnamentItems(_:for:) for how to add the above items to the main toolbar.

Note: Please bear in mind that this API and its friends are subjected to change as the visionOS SDK is still in its preview stage. See https://pspdfkit.com/blog/2023/pspdfkit-for-visionos-public-preview/ Please reach out to us on support (https://pspdfkit.com/support/request) if you have any questions about the API.

  • id

    Unique id for the ornament item.

  • Defines the kind of the ornament item which also stores the information to be displayed

  • Whether the item is enabled.

  • Selection state of the item.