Читать книгу SwiftUI For Dummies - Wei-Meng Lee - Страница 15

Working with Live Preview

Оглавление

Your code will change the text on the label when the button is clicked (or tapped on a real device). However, if you try clicking the button on the preview canvas, there is no reaction. This is because the preview canvas only allows previewing your UI — it doesn’t run your application. To run the application, you need to click the Live Preview button (see Figure 1-14).


FIGURE 1-14: Clicking the Live Preview button allows you to run your application directly on the canvas.

When the Live Preview mode is turned on, the background of the simulator will turn dark (see the left side of Figure 1-15). You can now click on the button and the text on the label will be updated (see the right side of Figure 1-15).


FIGURE 1-15: Testing your application in Live Preview mode.

SwiftUI For Dummies

Подняться наверх