Contained in: Supporting SwiftUI with Core Graphics
swiftui
iOS & Swift
Supporting SwiftUI with Core Graphics
Nov 22 2022 · Video Course (43 mins)
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…
iOS & Swift
Host a UIView in a SwiftUI View
Nov 22 2022 · Lesson
Upgrade a SwiftUI drawing pad to UIKit. Examine the app architecture and understand how to insert UIKit views in a SwiftUI…
iOS & Swift
Anatomy of a View
Nov 22 2022 · Lesson
Review how the SwiftUI paradigm differs from UIKit. Learn how a view is rendered, and discover Core Animation layers and Core Graphics contexts…
iOS & Swift
Create a CGImage
Nov 22 2022 · Lesson
…them laid out in 3d. On the left, all the views are listed in a hierarchy, and you can see how the SwiftUI views are hosted in a UIWindow. Open up the Object Inspector and you can see that the SwiftUI views are hosted by a UIHostingController…
iOS & Swift
Color Picking from a Bitmap Image
Nov 22 2022 · Lesson
…very simple view. When you’re setting borders and shadows for UIView, you have to do it on the view’s Core Animation layer. SwiftUI has done away with all that, and in SwiftUI we work directly with Views. But here we’re using a UIView, so we change…
iOS & Swift
Build a UIKit Drawing Pad
Nov 22 2022 · Lesson
…user has used several fingers, but in this case we only want the first one. Instead of saving a path, like in the SwiftUI drawing pad, we’re going to draw a stroke directly into the drawingImage. Set up the image with UIGraphicsImageRenderer. drawingImage = UIGraphicsImageRenderer(size: bounds.size).image { context…
iOS & Swift
Create a Thumbnail
Nov 22 2022 · Lesson
…drawing button, draw a picture and then save it. Now, this drawing is huge. We could resize it with SwiftUI modifiers, but as an alternative, I’m going to show you how to render a smaller version of an image. Model.swift We’ll start in the model, again. Create…
iOS & Swift
Drawing with Pencil
Nov 22 2022 · Lesson
When I draw really fast, the lines aren’t smooth, because we’re drawing straight lines between the drag points. Coalesced Touches In the SwiftUI drawing pad, we replaced the stroke after drawing it with a Bezier spline which smoothed out the curve, but Pencil has a clever…