Post

Replies

Boosts

Views

Activity

Reply to Two synchronized lists
I haven't written the code yet, because I don't know how to do it right. I just have separate horizontal and vertical scrolling lists. LazyVStack(alignment: .leading, spacing: 15, pinnedViews: [.sectionHeaders], content: {                         if (tags != nil){                             ScrollView (.horizontal, showsIndicators: false) {                                 HStack{                                     ForEach(tags){tag in                                         TagView(tag: tag)                                             .onTapGesture(count: 1) {                                                 print(tag.name)                                             }                                     }                                 }                             }                         }                         VStack(alignment: .leading){                             Divider()                             Text("Example")                                 .font(.system(size:19))                                 .fontWeight(.bold)                                 .padding(.vertical, 10.0)                                 .foregroundColor(textColor)                             Divider()                             if (rests != nil){                                 ScrollView(.vertical, showsIndicators: true, content: {                                     ForEach(rests){rest in                                             RestView(rest: rest)                                     }                                 })                                 .padding(.top, 15.0)                             }                         }                         .padding(.leading, 15.0)                     }) I have a list in which there are groups, these groups should be above the vertical list in the form of a horizontal list, and if you scroll through the vertical list, then the top list automatically switches to the desired group
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21