Starting to use PencilKit and look inside.

Updated
Apr 5, 2021 10:03 AM
Created
Mar 20, 2021 7:04 AM
Tags
CocoaSwift
Keywords
Date

PencilKit

It's super simple to start using PencilKit in our application.

let canvas = PKCanvasView(frame: view.frame)
view.addSubview(canvas)
canvas.tool = PKInkingTool(.pen, color: .black, width: 30)

Inside

image

Displays drawings with tiling layers

image

(lldb) po 0x2836e0630
<PKRendererTile 0x2836e0630 [0, (0, 1)] frame={{0, 256}, {256, 256}} 2>

(lldb) po [0x2836e0630 superclass]
CALayer

Actives CanvasView and CAMetalLayer while drawing.

image

Resources