the drawing has changed. func canvasViewDrawingDidChange(_ canvasView: PKCanvasView) { hasModifiedDrawing = true updateContentSizeForDrawing() } /// Helper method to set a suitable content size for the canvas view. func updateContentSizeForDrawing() { // Update the content size to match the drawing. let drawing = canvasView.drawing let contentHeight: CGFloat // Adjust the content size to always be bigger than the drawing height. if !drawing.bounds.isNull { contentHeight = max(canvasView.bounds.height, (drawing.bounds.maxY + DrawingViewController.canvasOverscrollHeight) * canvasView.zoomScale) } else { contentHeight = canvasView.bounds.height } canvasView.contentSize = CGSize(width: DataModel.canvasWidth * canvasView.zoomScale, height: contentHeight) } ˞88%$ͷαϯϓϧΑΓ