Drawing in iOS with SwiftUI
Jun 7 2022 · Video Course (1 hr, 57 mins)
Learn about drawing using SwiftUI by creating custom controls using a combination of SwiftUI and Core Graphics. Covers shapes, colors, drawing with Pencil, and how to integrate them into a non-trivial…
iOS & Swift
Shapes
Jun 7 2022 · Lesson
Catie, welcome to Drawing in iOS with SwiftUI. In this course, we’ll be using SwiftUI to create a mind map app with rearrangeable cells that can contain text or drawings. We’ll start out learning how to draw custom shapes and use colors, and how to lay out views…
iOS & Swift
Drawing Pad
Jun 7 2022 · Lesson
…this episode, learn how easy it is to create a simple drawing pad using drag gestures and SwiftUI paths…
iOS & Swift
Color Picker
Jun 7 2022 · Lesson
…other colors with variations for dark mode, too, if you like. Now to hook those up to some code, create a new SwiftUI View file for our control called ColorPicker. This file will hold both our ColorPicker, and a View to preview it. Similar to what we did with…
iOS & Swift
Create & Select Cells
Jun 7 2022 · Lesson
…cells, including the cells location so that we can adjust their position in ContentView. Create a new Swift file called CellModel.swift. Import SwiftUI and Combine, which we’ll need for storing the data model import SwiftUI import Combine Create a new structure to hold an individual cell. struct Cell: Identifiable…
iOS & Swift
Colors
Jun 7 2022 · Lesson
…quick overview of how to use SwiftUI colors, so let’s look at how to use colors, gradients and schemes in more detail. Each of the system colors such as the .teal we used, is a predefined static Color property. UIKit offers even more system colors, if we initialize SwiftUI…
iOS & Swift
Install Custom Menu
Jun 7 2022 · Lesson
…offset(x: cell.size.width / 2, y: -cell.size.height / 2) With the menu installed, we’re ready to hook up the actions. The first option is delete. SwiftUI’s reactivity really shines here. All we need to do is remove the selected cell from our data model’s array. Then we can rely…
iOS & Swift
Custom Shapes
Jun 7 2022 · Lesson
Explore SwiftUI paths, learn to create simple custom shapes, and the many ways of outlining with a stroke…
iOS & Swift
Curves & Transforms
Jun 7 2022 · Lesson
…deeper into SwiftUI paths and draw a custom heart shape with help from Bezier curves and transforms…
iOS & Swift
Add Gestures
Jun 7 2022 · Lesson
…with the gestures we already have is that if I tap the text area instead of the shape background and then tap the background, SwiftUI thinks I’m still editing the text field. We used to have to reach into UIKit to handle this, but we’ve got another option…
iOS & Swift
Display Shapes in a Grid
Jun 7 2022 · Lesson
…infer the type from its body property. Swift 5.1 introduced opaque types to deal with this with the some keyword. When you create a SwiftUI View, the view must contain a body property, which returns some other structure that conforms to View. If you’ve ever tried to inspect…
iOS & Swift
Create a Custom Control
Jun 7 2022 · Lesson
…practical. We might want to use these custom controls in our other apps, so we’ll make them as generic as we can and SwiftUI encourages us to make our views modular. A control consists of a user interface - that’s one or more views with interaction…
iOS & Swift
Custom Menu
Jun 7 2022 · Lesson
…much new in this, but it’s an example of putting something together that’s fairly complex. FlyoutMenu.swift Create a new SwiftUI View file for the menu called FlyoutMenu. To start, we’ll make that red circular button with a plus sign in it. And to hold that…
iOS & Swift
Custom SF Symbol
Jun 7 2022 · Lesson
…font(.system(size: 60, weight: .ultraLight)) .font(.largeTitle) .foregroundColor(.teal) As long as you don’t try to use a different scale or weight, SwiftUI will default to the medium scale and regular weight we’ve supplied, and adjust the size nicely for us. Before we move on, restore…
iOS & Swift
Install Drawing Pad
Jun 7 2022 · Lesson
…some navigation features to handle that, and we don’t really want those in our Canvas control. So, let’s set up a new SwiftUI View to hold the canvas. DrawingPadView Add it out here, next to BackgroundView, and call it DrawingPadView Just like for the Shape Selection Grid…