View on GitHub

Swift Dev Journal's Intro to SwiftUI

A guide introducing SwiftUI to inexperienced developers.

Browsing the SwiftUI View Library

You started learning SwiftUI and want to see the available views. Use the SwiftUI view library in Xcode to browse the views you can use in a SwiftUI app.

Hold down the Option key and click the Add button in the project window toolbar to open the SwiftUI view library. Option-clicking the Add button will keep the library window open until you close it.

SwiftUIViewLibrary

If the library window shows code snippets instead of SwiftUI views, make sure you have a SwiftUI view file open and have the preview canvas open. The preview canvas must be open for the library window to show SwiftUI views.

View Library Contents

The left side of the library window shows the available SwiftUI views, starting with controls, followed by layout views, and ending with miscellaneous.

Selecting a view fills the right side of the window with a summary of the view.

Adding a Control to Your View

Selecting a control from the view library and dragging it to the view’s Swift file adds the control to your SwiftUI view.