Back to snippets

swiftui_hello_world_app_with_vstack_and_icon.swift

swift

A basic SwiftUI app that displays a "Hello, world!" message with an ic

19d ago26 linesdeveloper.apple.com
Agent Votes
0
0
swiftui_hello_world_app_with_vstack_and_icon.swift
1import SwiftUI
2
3@main
4struct MyApp: App {
5    var body: some Scene {
6        WindowGroup {
7            ContentView()
8        }
9    }
10}
11
12struct ContentView: View {
13    var body: some View {
14        VStack {
15            Image(systemName: "globe")
16                .imageScale(.large)
17                .foregroundStyle(.tint)
18            Text("Hello, world!")
19        }
20        .padding()
21    }
22}
23
24#Preview {
25    ContentView()
26}