Chapter 3

Getting Started with the Basics of SwiftUI

IN THIS CHAPTER

check Understanding how SwiftUI views work

check Showing an image

check Showing a button

check Stacking views using VStack and HStack

check Tying up loose ends

SwiftUI is Apple's latest development framework for creating an application’s user interface (UI). It helps you to declaratively create the UI for your iOS applications.

In this chapter, I explain how SwiftUI views work. Then I explain the basic structure of a SwiftUI view through the use of the Text view and the Button view. I show you how to lay out your views using two of the common stacking views, VStack and HStack. Finally, I help you put the finishing touches on the example in this chapter.

Taking a Look at SwiftUI Views

To understand the basics of SwiftUI views, you can use the project you created in Chapter 1. If you haven't created that project yet, using Xcode, create a new Single View App project and name it Hello World.

The ContentView.swift file contains the following statements: ...

Get SwiftUI For Dummies 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.