如果在我快速搜索找不到答案之前有人问过这个问题,请原谅我。我正在创建一个应用程序,用户可以在其中接收好友请求,并且我希望用户能够向左滑动以显示不同的选项来接受或拒绝请求
如果有帮助,这是我的滚动视图
ScrollView(.vertical){
VStack(spacing: 40){
// TODO Add Chat Rooms
ForEach(ChatRooms, content: {room in
//Create an in app link that navigates to messaging screen
NavigationLink(
destination: MessageDetail(messageShowing: $detailShowing),
isActive: $detailShowing,
label: {
//Create a chat room card
Button(action: {
detailShowing = true
}, label: {
ChatRoomView(room: room)
}).buttonStyle(PlainButtonStyle())
}
).buttonStyle(PlainButtonStyle())
})
}.padding(.top, 30)
}
编辑:我尝试在我的垂直滚动视图中嵌套一个水平滚动视图,如下所示 ScrollView (.horizontal) { VStack(spacing: 40){
// TODO Add Chat Rooms
ForEach(ChatRooms, content: {room in
//Create an in app link that navigates to messaging screen
ScrollView (.horizontal) {
NavigationLink(
destination: MessageDetail(messageShowing: $detailShowing),
isActive: $detailShowing,
label: {
//Create a chat room card
Button(action: {
detailShowing = true
}, label: {
ChatRoomView(room: room)
}).buttonStyle(PlainButtonStyle())
}
).buttonStyle(PlainButtonStyle())
}
})
}.padding(.top, 30)
}
但这就是我的结局