3

Is there a way to customize SwiftUI List so cells are displayed from bottom to top?

Related question with UITableView: How to populate UITableView from the bottom upwards?

randomor
  • 4,801
  • 3
  • 42
  • 67
  • 1
    I'm not sure if `List` has this ability (yet) but what you (obviously) could do is to just use a UITableView with the linked answer inside a custom UIViewRepresentable-View. [docs](https://developer.apple.com/documentation/swiftui/uiviewrepresentable) – thisIsTheFoxe Sep 25 '19 at 13:36

1 Answers1

2
struct FlipEffect: GeometryEffect {
    func effectValue(size: CGSize) -> ProjectionTransform {
        let t = CGAffineTransform(a: 1, b: 0, c: 0, d: -1, tx: 0, ty: size.height)
        return ProjectionTransform(t)
    }
}

struct ContentView: View {
    var body: some View {
        List(0..<100) { item in
            Text("hello, world")
                .modifier(FlipEffect())
        }
        .modifier(FlipEffect())
    }
}
Shintaro Abe
  • 131
  • 4