import SwiftUI
struct SwiftUIBenefitsView: View {
var body: some View {
VStack(alignment: .leading, spacing: 10) {
Text("SwiftUI Benefits")
.font(.largeTitle)
.bold()
.padding(.bottom, 20)
Text("* Declarative syntax")
Text("* Live preview")
Text("* Less code")
Text("* Cross-platform")
Text("* Accessibility built")
Spacer()
Button("Close") {
print("Closed")
}
.frame(maxWidth: .infinity)
.padding()
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(8)
}
.padding()
}
}
struct SwiftUIBenefitsView_Previews: PreviewProvider {
static var previews: some View {
SwiftUIBenefitsView()
}
}This screen uses a vertical stack (VStack) to arrange the content from top to bottom.
The title uses a large, bold font to stand out.
Each reason is shown as a separate Text view with a bullet point for clarity.
The Close button is styled with a blue background and white text, filling the width for easy tapping.
When the Close button is tapped, it prints "Closed" to the console, simulating a close action.
This simple layout demonstrates SwiftUI's declarative syntax and easy UI building.