Swiftui, Mobile App Development, Programming, Learning To Code, iOS App Development.
the variable struct ColorExample: View{ @State var mainColor : Color = Color.red var body: some View{ //Use the $ sign to bind this variable in the init of the sub view SubViewWithBackground(backgroundColor: $mainColor) } } struct SubViewWithBackground : View { @Binding var backgroundColor : Color