简体   繁体   中英

Layout SwiftUI List cells from bottom upward

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?

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())
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM