HI all,
New to Xcode and coding. Taking the first steps
Have a VStack then there is an HStack with a button. What i would like to know is when I press the button inside the HStack it will change the background color of the VStack, from black to other color.
Here is a sample of the code.
Thanks all for the time to reply and help.
import SwiftUI
struct ContentView: View {
@State var index = 0
var body: some View {
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
struct CustomTabs : View {
@Binding var index : Int
var body: some View {
New to Xcode and coding. Taking the first steps
Have a VStack then there is an HStack with a button. What i would like to know is when I press the button inside the HStack it will change the background color of the VStack, from black to other color.
Here is a sample of the code.
Thanks all for the time to reply and help.
import SwiftUI
struct ContentView: View {
@State var index = 0
var body: some View {
Code Block VStack{ Spacer() CustomTabs(index: self.$index) }.background(Color.black)
}}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
struct CustomTabs : View {
@Binding var index : Int
var body: some View {
Code Block HStack{ Button(action: { self.index = 0 }) { Spacer() Image("fdt") Spacer() }