prompt
stringclasses 4
values | output
stringclasses 4
values |
---|---|
Create a SwiftUI view with a button that changes text on tap | import SwiftUI
struct ContentView: View {
@State private var text = "Hello, World!"
var body: some View {
VStack {
Text(text)
.font(.largeTitle)
Button("Tap me") {
text = "Button Tapped!"
}
.padding()
}
}
} |
Create a SwiftUI view with a TextField and a Text showing its value | import SwiftUI
struct ContentView: View {
@State private var name = ""
var body: some View {
VStack {
TextField("Enter your name", text: $name)
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding()
Text("Hello, \(name)!")
.font(.title)
}
.padding()
}
} |
Create a SwiftUI List with 5 items | import SwiftUI
struct ContentView: View {
let items = ["Item 1", "Item 2", "Item 3", "Item 4", "Item 5"]
var body: some View {
List(items, id: \ .self) { item in
Text(item)
}
}
} |
Create a SwiftUI view with a toggle switch | import SwiftUI
struct ContentView: View {
@State private var isOn = false
var body: some View {
VStack {
Toggle("Enable Feature", isOn: $isOn)
.padding()
Text(isOn ? "Feature is ON" : "Feature is OFF")
.font(.title)
}
.padding()
}
} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.