From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

SwiftUI borders and shapes

SwiftUI borders and shapes

From the course: iOS Development Tips

SwiftUI borders and shapes

- [Instructor] SwiftUI has basic shapes to use in your user interface to find all ready for you, with the basic shapes of rectangle, rounded rectangle, capsule, ellipse and circle. You code much of your UI without ever needing to draw. I've a project here, which we'll demonstrate this. It's a simple app of an SF Symbol and a text view that counts if pressed. I'll go ahead and run it here for you. And if you give it a long press, it resets. I added a GeometryReader to this, which you can learn more about in our previous tip, which will help us a lot later. When working with shapes, you use backgrounds, overlays and stacks for positioning. Backgrounds are very easy to use. Just below the HStack frame, at a background for capsule for the shape. So you can read the HStack, and here, we got a frame for it, and you can see all the geometry stuff there. And between the frame and the TapGesture, I'm going to tab over here,…

Contents