import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
VStack(alignment: .leading, spacing: 20) {
HStack(alignment: .top, spacing: 15) {
Text("📱")
.font(.largeTitle)
VStack(alignment: .leading, spacing: 5) {
Text("iPhone")
.font(.headline)
Text("A powerful smartphone.")
.font(.subheadline)
.foregroundColor(.secondary)
}
}
HStack(alignment: .top, spacing: 15) {
Text("📲")
.font(.largeTitle)
VStack(alignment: .leading, spacing: 5) {
Text("iPad")
.font(.headline)
Text("A versatile tablet.")
.font(.subheadline)
.foregroundColor(.secondary)
}
}
HStack(alignment: .top, spacing: 15) {
Text("⌚")
.font(.largeTitle)
VStack(alignment: .leading, spacing: 5) {
Text("Apple Watch")
.font(.headline)
Text("A handy smartwatch.")
.font(.subheadline)
.foregroundColor(.secondary)
}
}
Spacer()
}
.padding()
.navigationTitle("Device Info Overview")
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}This SwiftUI view uses a NavigationView to provide a navigation bar with the title "Device Info Overview". Inside, a vertical stack (VStack) arranges three horizontal stacks (HStack), each representing a device.
Each HStack has an emoji icon on the left with a large font size, and a vertical stack (VStack) on the right containing the device name in headline font and a short description in a smaller, secondary-colored font. Spacing and alignment ensure the layout is neat and readable.
This simple layout introduces how to combine text and icons to create an overview screen for multiple devices in the iOS ecosystem.