Complete the code to create a basic SwiftUI app entry point.
import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { [1]() } } }
The main view of a SwiftUI app is usually called ContentView. This is where the UI starts.
Complete the code to declare the main app struct conforming to the SwiftUI App protocol.
import SwiftUI @main struct [1]: App { var body: some Scene { WindowGroup { ContentView() } } }
The main app struct name is usually MyApp by default in new SwiftUI projects.
Fix the error in the code by completing the missing keyword to define the app's main entry point.
import SwiftUI [1] struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } }
The @main attribute tells Swift this is the app's entry point in SwiftUI.
Fill both blanks to complete the SwiftUI view struct with a Text label.
import SwiftUI struct ContentView: View { var body: some View { [1]("Hello, world!") .[2]() } }
The Text view shows text, and padding() adds space around it.
Fill all three blanks to create a SwiftUI app with a main struct, a ContentView, and a Text label.
import SwiftUI @[1] struct [2]: App { var body: some Scene { WindowGroup { [3]() } } } struct ContentView: View { var body: some View { Text("Welcome to my app!") } }
The @main attribute marks the app entry. MyApp is the app struct name. ContentView is the main UI view.