8
Drawing with SwiftUI
One of the strongest points of SwiftUI is that all the components are uniform and they can be used in an interchangeable and mixed way, whereas in UIKit, intermixing labels, buttons, and custom shapes was a bit cumbersome. In this chapter, we’ll learn how to use the basic shapes offered out of the box by SwiftUI and how to create new shapes using the Path
class. We’ll learn how simple and natural it is to deal with, extend, and use custom shapes with standard components, such as text and sliders.
By the end of the chapter, you’ll be able to create a view from a custom path, add a gradient to fill a custom view, and write a Tic-Tac-Toe game using basic shapes.
In this chapter, we will cover the following recipes:
- Using ...
Get SwiftUI Cookbook - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.