i have idea ;)
private var messageList: some View {
ScrollView {
LazyVStack(spacing: 8) {
ForEach(chat.messageList.reversed()) { message in
MessageBubble(message: message)
.id(message.id)
.rotationEffect(.radians(.pi)) // 旋转180度
.scaleEffect(x: -1, y: 1, anchor: .center) // 水平翻转
}
}
.padding(.vertical, 8)
}
.rotationEffect(.radians(.pi)) // 旋转180度
.scaleEffect(x: -1, y: 1, anchor: .center) // 水平翻转
.scrollPosition($scrollPosition, anchor: .top)
.onAppear {
scrollPosition.scrollTo(edge: .top)
}
}