Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
struct MyView: View {
@State var text: String = "hello"
var body: some View {
TextField("title", text: $text)
}
}
struct ContentView: View {
@State var toggled: Bool = false
var body: some View {
let theTextView = MyView()
return VStack {
Toggle(isOn: $toggled, label: { Text("Toggle") })
if toggled {
theTextView
} else {
theTextView.accentColor(.green)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.