Better Programming

Advice for programmers.

Follow publication

Member-only story

Implementing SwiftUI Canvas in iOS 15

A look at using the new Canvas view in SwiftUI

Mark Lucking
Better Programming
Published in
4 min readSep 23, 2021
SwiftUI Canvas demo
Animated GIF showing the new Apple Canvas View in SwiftUI 3.0

Unfortunately, SwiftUI remains a little unfinished — at least compared to its big brother UIKit. Even though it is in its third revision with iOS15, it is still missing some important views.

I feel, one of the main challenges remaining for Apple is being how to make the transition as painless as possible. Nobody wants to rewrite UI/UX code — companies certainly can’t afford to. They need a way to reuse as much of the code they already have, but without the UIKit baggage that comes with it.

Besides that, SwiftUI is a very new paradigm, tweaking some controls which developers had previously mastered. So although they didn’t say as much in their recent WWDC 21 presentation on the subject Apple is trying in my view cover some middle ground here. Middle ground with a new view called Canvas. A compromise in some ways.

It was presented at the WWDC 21 as a more efficient way to do drawings. It may well be more efficient in terms of CPU, but watching it I couldn’t help but think it is more efficient too in terms of code migration, supporting Core Graphics primitives natively, something you could not do in SwiftUI before so easily — it was a little painful with the need to convert between UIImages and Images.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Mark Lucking
Mark Lucking

Written by Mark Lucking

Coding for 35+ years, enjoying using and learning Swift/iOS development. Writer @ Better Programming, @The StartUp, @Mac O’Clock, Level Up Coding & More

Responses (3)

Write a response