```struct menu : View { @Binding var size : CGFloat @State var logout: Bool = false @State private var didSubMenuPressed: Bool = false @State var sideMenuEntries = [ SideMenuData(index: 0, imageName: "info.circle", menuText: "Info", subMenu: ["Info1", "Info2", "Info3", "Info4"], expand: false), SideMenuData(index: 1, imageName: "doc.on.doc", menuText: "Documents", subMenu: ["Documents1", "Documents2"], expand: false) ] var body : some View{ VStack (alignment: .leading){ HStack{ Spacer() Button(action: { self.size = UIScreen.main.bounds.width / 1.6 }) { Image("close").resizable() .frame(width: 15, height: 15) .padding() } .foregroundColor(.white) .clipShape(Circle()) } ForEach (sideMenuEntries.indices) { index in VStack (alignment: .leading, spacing: 0, content: { HStack{ Image(self.sideMenuEntries[index].imageName).resizable().frame(width: 25, height: 25) .foregroundColor(.white) Text(self.sideMenuEntries[index].menuText).fontWeight(.heavy).foregroundColor(.white) if self.sideMenuEntries[index].subMenu.count > 1 { Image(systemName: self.sideMenuEntries[index].expand ? "chevron.compact.up" : "chevron.compact.down") .resizable() .frame(width: 10, height: 10) .foregroundColor(.white) } Image("logout-1").resizable().frame(width: 25, height: 25)//.padding(.leading, 5) .foregroundColor(.white) Text(self.sideMenuEntries[index].menuText).fontWeight(.heavy).foregroundColor(.white) if self.logout { // } } .contentShape(Rectangle()) .onTapGesture { self.sideMenuEntries[index].expand.toggle() } if self.sideMenuEntries[index].expand { VStack (alignment: .leading){ ForEach (self.sideMenuEntries[index].subMenu.indices) { index1 in Button(action: { print("\(self.sideMenuEntries[index].subMenu[index1]) is pressed") self.size = UIScreen.main.bounds.width / 1.6 self.didSubMenuPressed.toggle() }){ Text(self.sideMenuEntries[index].subMenu[index1]) .foregroundColor(.white) } .padding([.top, .bottom], 7) } } .padding(.top, 14) .padding(.leading, 34) } }) } Spacer() } .padding(.leading, 40) .frame(width: UIScreen.main.bounds.width / 1.3) .background(LinearGradient( gradient: Gradient( colors: [.buttonGradientStartColor, .buttonGradientEndColor]), startPoint: .top, endPoint: .bottom)) // if u want to change swipe menu background color } } ```