I\'m new in SwiftUI, trying to make something like reverse
in Android LinearLayoutManager
mess
@cipais's answer worked well. https://stackoverflow.com/a/61036551/12208004
List(chatController.messages, id: \.self) { message in
MessageView(message.text, message.isMe)
.rotationEffect(.radians(.pi))
.scaleEffect(x: -1, y: 1, anchor: .center)
}
.rotationEffect(.radians(.pi))
.scaleEffect(x: -1, y: 1, anchor: .center)
There is a trick on UITableView
that you flip the table and each cell. So it appears to be filling from bottom. You can do this trick in SwiftUI too:
Fully Working Demo:
struct ContentView: View {
@State private var ids = [String]()
init() {
UITableView.appearance().tableFooterView = UIView()
UITableView.appearance().separatorStyle = .none
}
var body: some View {
ZStack {
List(ids, id: \.self) { id in
Text(id).scaleEffect(x: 1, y: -1, anchor: .center)
}.scaleEffect(x: 1, y: -1, anchor: .center)
Button("Touch") {
self.ids.append(UUID().uuidString)
}
}
}
}