When using Storyboards, you modify attributes of a view using the Attributes inspector. In SwiftUI, you can modify either your code or the preview. As you will see, changing the code in ContentView.swift will immediately update the preview, and modifying the preview will update the code.
Let's learn how you can modify the text view in your project. Perform the following steps:
- In the preview, command + click the Lets Eat text on the screen. The structured editing popover will appear. Choose Show SwiftUI Inspector...:
- SwiftUI Inspector appears on screen. Change the Text modifier to The Tap Trailhouse. This is the name of a restaurant in Boston, and can be found in the Boston.json file:
- Change the Font modifier to Title:
- The code in ContentView.swift will be automatically updated, as shown:
struct ContentView: View {
var body: some View {
...