Supporting SwiftUI with Core Graphics

Learn how to support SwiftUI drawing with Core Graphics! This course picks up where our Drawing in iOS with SwiftUI course left off. You’ll enhance the Open Mind app with help from UIKit and Core Graphics. You’ll learn how to integrate UIKit views with SwiftUI, use UIKit touch methods to capture Apple Pencil drawing, and make the whole drawing view a UIControl that we can plug into any of our future SwiftUI apps. By Catie Catterwaul.

Leave a rating/review
Download materials
Save for later

Who is this for?

This course is for iOS developers who are familiar with Swift and SwiftUI fundamentals, and would like to enhance their SwiftUI graphics by integrating with Core Graphics and UIKit.

Covered concepts

  • Core Graphics
  • SwiftUI Graphics
  • Apple Pencil

Part 1: Supporting SwiftUI with Core Graphics

Toggle description

Review how the SwiftUI paradigm differs from UIKit. Learn how a view is rendered, and discover Core Animation layers and Core Graphics contexts.

Toggle description

Examine the View Hierarchy Debugger in Xcode. Then create a Core Graphics context, draw into it and extract an image.

Toggle description

Upgrade a SwiftUI drawing pad to UIKit. Examine the app architecture and understand how to insert UIKit views in a SwiftUI app.

Toggle description

Capture touches and turn them into drawing strokes with UIKit and Core Graphics.

Toggle description

Learn how to use Pencil for custom drawing and draw smooth lines with thickness dependent on pressure.

Toggle description

Understand the extra features that drawing with Pencil gives you. Use the tilt of the pencil to change from drawing to shading.

Toggle description

Learn to extract a sketch from the drawing pad into an image, create a thumbnail, and display it on a mind map cell.

Toggle description

Go low-level into Core Graphics and examine individual pixels. Learn how to retrieve the pixel color and switch the drawing color to this color.