One Logo Pool Ball
PaperKit · IOS API REFERENCE

PaperMarkupViewController

class · iOS 26.0+ · SDK 27.1

@MainActor @objc @preconcurrency class PaperMarkupViewController

A view controller for interactively creating and showing markup. Properties are observable, so to save markup changes to disk, iterate over the changes to `markup`. ``` let markups = Observations.untilFinished { [weak paperViewController] in if let markup = paperViewController?.markup { return .next(markup) } return .finish } Task { [weak self] in for await newMarkup in markups { self?.save(model) } } ```

Members (47)

method · iOS 26.0+

toolPickerIsRulerActiveDidChange

TypeScript
toolPickerIsRulerActiveDidChange(toolPicker: _PencilKit_PKToolPicker): Promise<void>
Swift declaration
@MainActor @preconcurrency func toolPickerIsRulerActiveDidChange(_ toolPicker: PKToolPicker)
method · iOS 26.0+

toolPickerSelectedToolItemDidChange

TypeScript
toolPickerSelectedToolItemDidChange(toolPicker: _PencilKit_PKToolPicker): Promise<void>
Swift declaration
@MainActor @preconcurrency func toolPickerSelectedToolItemDidChange(_ toolPicker: PKToolPicker)
method · iOS 26.0+

viewDidLoad

TypeScript
viewDidLoad(): Promise<void>
Swift declaration
@MainActor @preconcurrency override dynamic func viewDidLoad()
get · iOS 26.0+

canBecomeFirstResponder

TypeScript
get canBecomeFirstResponder(): Promise<boolean>
Swift declaration
@MainActor @preconcurrency override dynamic var canBecomeFirstResponder: Bool { get }
get · iOS 26.0+

undoManager

TypeScript
get undoManager(): Promise<(_Foundation_UndoManager) | null>
Swift declaration
@MainActor @preconcurrency override dynamic var undoManager: UndoManager? { get }
method · iOS 26.0+

markupEditViewController

TypeScript
markupEditViewControllerInsertNewShape(markupEditViewController: MarkupEditViewController, type: ShapeConfiguration_Shape): Promise<void>
Swift declaration
@MainActor @preconcurrency func markupEditViewController(_ markupEditViewController: MarkupEditViewController, insertNewShape type: ShapeConfiguration.Shape)

Add a new shape on top of the paper. - Parameters: - markupEditViewController: The source of the action. - type: The type of shape.

method · iOS 26.0+

markupEditViewController

TypeScript
markupEditViewControllerInsertNewContents(markupEditViewController: MarkupEditViewController, toInsert: PaperMarkup): Promise<void>
Swift declaration
@MainActor @preconcurrency func markupEditViewController(_ markupEditViewController: MarkupEditViewController, insertNewContents toInsert: PaperMarkup)

Add new content on top of the paper. - Parameters: - markupEditViewController: The source of the action. - toInsert: The markup whose contents is added on top of this paper. This is used for inserting any custom content, and non-shape elements like signatures or loupes.

method · iOS 26.0+

markupEditViewController

TypeScript
markupEditViewControllerInsertNewLineWithStartMarkerEndMarker(markupEditViewController: MarkupEditViewController, lineStartMarker: boolean, lineEndMarker: boolean): Promise<void>
Swift declaration
@MainActor @preconcurrency func markupEditViewController(_ markupEditViewController: MarkupEditViewController, insertNewLineWithStartMarker lineStartMarker: Bool, endMarker lineEndMarker: Bool)

Add a new line on top of the paper. - Parameters: - markupEditViewController: The source of the action. - lineStartMarker: True if the start of the line has a marker / arrow. - lineEndMarker: True if the end of the line has a marker / arrow.

method · iOS 26.0+

markupEditViewControllerInsertNewTextbox

TypeScript
markupEditViewControllerInsertNewTextbox(markupEditViewController: MarkupEditViewController): Promise<void>
Swift declaration
@MainActor @preconcurrency func markupEditViewControllerInsertNewTextbox(_ markupEditViewController: MarkupEditViewController)

Add a new textbox on top of the paper. - Parameters: - markupEditViewController: The source of the action.

get · iOS 26.0+

contentView

TypeScript
get contentView(): Promise<(_UIKit_UIView) | null>
Swift declaration
@MainActor @preconcurrency var contentView: UIView? { get set }

The content that markup appears on top of. The system sizes the content view to the frame of the markup and adds it below all the markup and drawing. When `nil`, markup appears on top of a blank white canvas. Default is `nil`.

set · iOS 26.0+

contentView

TypeScript
setContentView(value?: (_UIKit_UIView) | null): Promise<void>
Swift declaration
@MainActor @preconcurrency var contentView: UIView? { get set }

The content that markup appears on top of. The system sizes the content view to the frame of the markup and adds it below all the markup and drawing. When `nil`, markup appears on top of a blank white canvas. Default is `nil`.

get · iOS 26.0+

selectedMarkup

TypeScript
get selectedMarkup(): Promise<PaperMarkup>
Swift declaration
@MainActor @preconcurrency var selectedMarkup: PaperMarkup { get set }

The selected contents in the UI.

set · iOS 26.0+

selectedMarkup

TypeScript
setSelectedMarkup(value: PaperMarkup): Promise<void>
Swift declaration
@MainActor @preconcurrency var selectedMarkup: PaperMarkup { get set }

The selected contents in the UI.

get · iOS 27.0+

adornments

TypeScript
get adornments(): Promise<Array<MarkupAdornment>>
Swift declaration
@MainActor @preconcurrency var adornments: [MarkupAdornment] { get set }

An array of visual adornments that appear on the markup canvas. Adornments are supplementary visual elements you place on the canvas above the primary markup content. You position adornments using anchor points and configure them to respond to interaction, zoom scaling, and movement. - Note: Adornments are expected to have unique IDs. If two or more adornments have the same ID, the system displays only one.

set · iOS 27.0+

adornments

TypeScript
setAdornments(value: Array<MarkupAdornment>): Promise<void>
Swift declaration
@MainActor @preconcurrency var adornments: [MarkupAdornment] { get set }

An array of visual adornments that appear on the markup canvas. Adornments are supplementary visual elements you place on the canvas above the primary markup content. You position adornments using anchor points and configure them to respond to interaction, zoom scaling, and movement. - Note: Adornments are expected to have unique IDs. If two or more adornments have the same ID, the system displays only one.

get · iOS 26.0+

isEditable

TypeScript
get isEditable(): Promise<boolean>
Swift declaration
@MainActor @preconcurrency var isEditable: Bool { get set }

A Boolean value that indicates whether a person can edit the canvas contents. This property controls whether a person can edit content. The default value is `true`. Coordinate this property with your `MarkupEditViewController` or `MarkupToolbarViewController` to prevent people from adding new canvas elements.

set · iOS 26.0+

isEditable

TypeScript
setIsEditable(value: boolean): Promise<void>
Swift declaration
@MainActor @preconcurrency var isEditable: Bool { get set }

A Boolean value that indicates whether a person can edit the canvas contents. This property controls whether a person can edit content. The default value is `true`. Coordinate this property with your `MarkupEditViewController` or `MarkupToolbarViewController` to prevent people from adding new canvas elements.

get · iOS 26.0+

drawingTool

TypeScript
get drawingTool(): Promise<SDKHandle>
Swift declaration
@MainActor @preconcurrency var drawingTool: any PKTool { get set }

The tool for drawing on the canvas. When a touch is a drawing interaction, the canvas uses this tool to draw. Default is `PKInkingTool(.pen)`.

set · iOS 26.0+

drawingTool

TypeScript
setDrawingTool(value: Implements<_PencilKit_PKTool> | SDKHandle): Promise<void>
Swift declaration
@MainActor @preconcurrency var drawingTool: any PKTool { get set }

The tool for drawing on the canvas. When a touch is a drawing interaction, the canvas uses this tool to draw. Default is `PKInkingTool(.pen)`.

get · iOS 26.0+

isRulerActive

TypeScript
get isRulerActive(): Promise<boolean>
Swift declaration
@MainActor @preconcurrency var isRulerActive: Bool { get set }

A Boolean value that indicates whether a ruler view is visible on the canvas.

set · iOS 26.0+

isRulerActive

TypeScript
setIsRulerActive(value: boolean): Promise<void>
Swift declaration
@MainActor @preconcurrency var isRulerActive: Bool { get set }

A Boolean value that indicates whether a ruler view is visible on the canvas.

method · iOS 27.0+

adornmentFrame

TypeScript
adornmentFrame(id: string): Promise<({ x: number; y: number; width: number; height: number }) | null>
Swift declaration
@MainActor @preconcurrency func adornmentFrame(for id: UUID) -> CGRect?

Returns the current frame of the specified adornment. This method calculates the visual frame of an adornment based on its anchor position, image size, attachment point, zoom scale and content offset. - Parameter id: The ID of the `MarkupAdornment` whose frame you want to retrieve. - Returns: The frame of the adornment in the coordinate system of this view controller's view, or `nil` if the canvas does not display the adornment or cannot determine its frame.

get · iOS 26.0+

directTouchMode

TypeScript
get directTouchMode(): Promise<PaperMarkupViewController_TouchMode>
Swift declaration
@MainActor @preconcurrency var directTouchMode: PaperMarkupViewController.TouchMode { get set }

The interaction mode for direct touches on the canvas. To control automatic behavior for direct touches based on system state, see `directTouchAutomaticallyDraws`. Default is `.selection`.

set · iOS 26.0+

directTouchMode

TypeScript
setDirectTouchMode(value: PaperMarkupViewController_TouchMode): Promise<void>
Swift declaration
@MainActor @preconcurrency var directTouchMode: PaperMarkupViewController.TouchMode { get set }

The interaction mode for direct touches on the canvas. To control automatic behavior for direct touches based on system state, see `directTouchAutomaticallyDraws`. Default is `.selection`.

get · iOS 26.0+

contentVisibleFrame

TypeScript
get contentVisibleFrame(): Promise<{ x: number; y: number; width: number; height: number }>
Swift declaration
@MainActor @preconcurrency var contentVisibleFrame: CGRect { get set }

The visible area of content in the scroll view. Modifying this property immediately moves the canvas, to animate changing the visible rect use ``setContentVisibleFrame(_:animated:)``.

set · iOS 26.0+

contentVisibleFrame

TypeScript
setContentVisibleFrame(value: { x: number; y: number; width: number; height: number }): Promise<void>
Swift declaration
@MainActor @preconcurrency var contentVisibleFrame: CGRect { get set }

The visible area of content in the scroll view. Modifying this property immediately moves the canvas, to animate changing the visible rect use ``setContentVisibleFrame(_:animated:)``.

get · iOS 27.0+

scrollConfiguration

TypeScript
get scrollConfiguration(): Promise<PaperMarkupViewController_ScrollConfiguration>
Swift declaration
@MainActor @preconcurrency var scrollConfiguration: PaperMarkupViewController.ScrollConfiguration { get }

The configuration object that provides access to scroll view functionality.

get · iOS 26.0+

supportedFeatureSet

TypeScript
get supportedFeatureSet(): Promise<FeatureSet>
Swift declaration
@MainActor @preconcurrency var supportedFeatureSet: FeatureSet { get }

The supported PaperKit features on this canvas.

method · iOS 26.0+

setContentVisibleFrame

TypeScript
setContentVisibleFrame66674(rect: { x: number; y: number; width: number; height: number }, animated: boolean): Promise<void>
Swift declaration
@MainActor @preconcurrency func setContentVisibleFrame(_ rect: CGRect, animated: Bool)

Zooms to a specific area of the content so that it’s visible in the scroll view. - Parameters: - rect: A rectangle defining an area of the content view. The rectangle should be in the coordinate space of the data model. - animated: `true` if the scrolling should be animated, `false` if it should be immediate. This method scrolls the content so that the area defined by rect is just visible. If the area is already visible, the method does nothing.

get · iOS 26.0+

indirectPointerTouchMode

TypeScript
get indirectPointerTouchMode(): Promise<PaperMarkupViewController_TouchMode>
Swift declaration
@MainActor @preconcurrency var indirectPointerTouchMode: PaperMarkupViewController.TouchMode { get set }

The interaction mode for indirect pointer touches on the canvas. Default is `.selection`.

set · iOS 26.0+

indirectPointerTouchMode

TypeScript
setIndirectPointerTouchMode(value: PaperMarkupViewController_TouchMode): Promise<void>
Swift declaration
@MainActor @preconcurrency var indirectPointerTouchMode: PaperMarkupViewController.TouchMode { get set }

The interaction mode for indirect pointer touches on the canvas. Default is `.selection`.

method · iOS 26.0+

suggestedFrameForInserting

TypeScript
suggestedFrameForInserting(frame: { x: number; y: number; width: number; height: number }): Promise<{ x: number; y: number; width: number; height: number }>
Swift declaration
@MainActor @preconcurrency func suggestedFrameForInserting(contentInFrame frame: CGRect) -> CGRect

Returns the suggested frame for inserting shapes and other content. - Parameters: - frame: The frame of the content you want to insert. - Returns: The suggested frame for the content. Use this value to transform a `PaperMarkup` before inserting it. ```swift var shapeFrame = CGRect(x: 100, y: 100, width: 300, height: 300) // Get the default frame for inserting, and insert the shape there. let suggestedFrame = paperViewController.suggestedFrameForInserting(contentInFrame: shapeFrame) paperViewController.markup.insertNewShape(configuration: shapeConfiguration, frame: suggestedFrame) ```

get · iOS 26.1+ · Deprecated in iOS 27.0

showsVerticalScrollIndicator

TypeScript
get showsVerticalScrollIndicator(): Promise<boolean>
Swift declaration
@MainActor @preconcurrency var showsVerticalScrollIndicator: Bool { get set }

A Boolean value that controls whether the vertical scroll indicator is visible. Default is `true`.

set · iOS 26.1+ · Deprecated in iOS 27.0

showsVerticalScrollIndicator

TypeScript
setShowsVerticalScrollIndicator(value: boolean): Promise<void>
Swift declaration
@MainActor @preconcurrency var showsVerticalScrollIndicator: Bool { get set }

A Boolean value that controls whether the vertical scroll indicator is visible. Default is `true`.

get · iOS 26.0+

directTouchAutomaticallyDraws

TypeScript
get directTouchAutomaticallyDraws(): Promise<boolean>
Swift declaration
@MainActor @preconcurrency var directTouchAutomaticallyDraws: Bool { get set }

A Boolean value that indicates whether direct touches automatically draw based on system state. Direct touches on the canvas behave as if `directTouchMode = .drawing` when `directTouchAutomaticallyDraws` is true, a `PKToolPicker` is visible, and the "Draw with Finger" system setting is on. Default is `true`.

set · iOS 26.0+

directTouchAutomaticallyDraws

TypeScript
setDirectTouchAutomaticallyDraws(value: boolean): Promise<void>
Swift declaration
@MainActor @preconcurrency var directTouchAutomaticallyDraws: Bool { get set }

A Boolean value that indicates whether direct touches automatically draw based on system state. Direct touches on the canvas behave as if `directTouchMode = .drawing` when `directTouchAutomaticallyDraws` is true, a `PKToolPicker` is visible, and the "Draw with Finger" system setting is on. Default is `true`.

get · iOS 26.1+ · Deprecated in iOS 27.0

showsHorizontalScrollIndicator

TypeScript
get showsHorizontalScrollIndicator(): Promise<boolean>
Swift declaration
@MainActor @preconcurrency var showsHorizontalScrollIndicator: Bool { get set }

A Boolean value that controls whether the horizontal scroll indicator is visible. Default is `true`.

set · iOS 26.1+ · Deprecated in iOS 27.0

showsHorizontalScrollIndicator

TypeScript
setShowsHorizontalScrollIndicator(value: boolean): Promise<void>
Swift declaration
@MainActor @preconcurrency var showsHorizontalScrollIndicator: Bool { get set }

A Boolean value that controls whether the horizontal scroll indicator is visible. Default is `true`.

init · iOS 26.0+

init

TypeScript
static init(markup: (PaperMarkup) | null, supportedFeatureSet: FeatureSet): Promise<PaperMarkupViewController>
Swift declaration
@MainActor @preconcurrency init(markup: PaperMarkup? = nil, supportedFeatureSet: FeatureSet)

Creates a new markup view controller with the provided data model. - Parameters: - markup: The data model to show on this canvas. The default value is `nil`. - supportedFeatureSet: The features this view controller supports. The canvas limits the edits that a person can make so they’re compatible with the feature set specified. If you set a `supportedFeatureSet`, also use a similar feature set to configure any `MarkupToolbarViewController` or `MarkupEditViewController` you use.

get · iOS 26.0+

markup

TypeScript
get markup(): Promise<(PaperMarkup) | null>
Swift declaration
@MainActor @preconcurrency var markup: PaperMarkup? { get set }

The paper data that this view controller displays. Observe `markup` to watch for markup changes.

set · iOS 26.0+

markup

TypeScript
setMarkup(value?: (PaperMarkup) | null): Promise<void>
Swift declaration
@MainActor @preconcurrency var markup: PaperMarkup? { get set }

The paper data that this view controller displays. Observe `markup` to watch for markup changes.

get · iOS 26.0+

delegate

TypeScript
get delegate(): Promise<(SDKHandle) | null>
Swift declaration
@MainActor @preconcurrency weak var delegate: (any PaperMarkupViewController.Delegate)? { get set }

The delegate for responding to a person's actions.

set · iOS 26.0+

delegate

TypeScript
setDelegate(value?: (SDKHandle) | null): Promise<void>
Swift declaration
@MainActor @preconcurrency weak var delegate: (any PaperMarkupViewController.Delegate)? { get set }

The delegate for responding to a person's actions.

get · iOS 27.0+

selection

TypeScript
get selection(): Promise<Array<MarkupOrderedSet_ElementID>>
Swift declaration
@MainActor @preconcurrency var selection: Set<MarkupOrderedSet.ElementID> { get set }

The current selected elements on the canvas.

set · iOS 27.0+

selection

TypeScript
setSelection(value: Array<MarkupOrderedSet_ElementID>): Promise<void>
Swift declaration
@MainActor @preconcurrency var selection: Set<MarkupOrderedSet.ElementID> { get set }

The current selected elements on the canvas.

get · iOS 26.0+

zoomRange

TypeScript
get zoomRange(): Promise<"animatableData" | SDKHandle>
Swift declaration
@MainActor @preconcurrency var zoomRange: ClosedRange<CGFloat> { get set }

A floating-point range that specifies the minimum and maximum scale factor that can apply to the canvas' content. The default value is `1.0...1.0`.

set · iOS 26.0+

zoomRange

TypeScript
setZoomRange(value: "animatableData" | SDKHandle): Promise<void>
Swift declaration
@MainActor @preconcurrency var zoomRange: ClosedRange<CGFloat> { get set }

A floating-point range that specifies the minimum and maximum scale factor that can apply to the canvas' content. The default value is `1.0...1.0`.

Skipped declarations

No declarations were skipped in this snapshot.

All PaperKit types →