April 2020
Beginner
316 pages
8h 20m
English
Let's start by creating a new playground project. Do this by clicking File | New | Playground. Call the project anything you like and add the following code to prepare your playground for SwiftUI:
import SwiftUIimport PlaygroundSupportstruct ContentView: View { var body: some View { }}PlaygroundPage.current.setLiveView(ContentView())
Now that we've got our playground set up, let's add some content to do. We'll start by adding a basic button and a Text view just beneath it:
struct ContentView: View { var body: some View { VStack { Button("Tap to Animate") { } Text("Learn SwiftUI") } }}
Great! Now, let's make the button disappear and reappear when we click it. We'll achieve this by changing the opacity of the Text view (the ...
Read now
Unlock full access