New in SwiftUI 3: Canvas

DevTechie
DevTechie
Oct 19, 2021 · 8 min read

SwiftUI 3 introduced a brand spanking new view called ✨ Canvas ✨ for rich and dynamic 2D graphics drawing.

Canvas view passes GraphicsContext and Size values to it closure which can be used to perform immediate mode drawing. Canvas can draw path, image, or complete SwiftUI views inside it.

Let’s take a look at Path drawing inside canvas:

struct SimpleCanvasExample…