Combining Views using Stacks

You have added a single text view to the screen of your project. Now you'll learn how to add multiple text views and combine them. When using storyboards, you can combine multiple views by embedding them in a stack view. In SwiftUI, you combine and embed them in stacks, which are similar to stack views in storyboards. Like stack views, you can group views horizontally or vertically.

The original Restaurant Detail screen for the Let's Eat app shows the address of the restaurant, so you'll use a horizontal stack view to place the restaurant's address and city below the restaurant name. Perform the following steps:

  1. command + click the text view's initializer to show the structured editing popover, then choose

Get iOS 13 Programming for Beginners - Fourth 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.