Compose SwiftUIv0.4.0
esc
GuideAPIGitHub
View

List

A container that presents rows of data in a scrolling column.

iOS 17.0+macOS 14.0+tvOS 17.0+watchOS 10.0+
fun List(modifier: Modifier = Modifier, content: @Composable () -> Unit)

Overview

Put rows inside the content lambda, or group them with Section. For long data, use LazyForEach: each row is composed only while it is on screen.

List {
    LazyForEach(messages, key = { it.id }) { message ->
        Text(message.subject)
    }
}

This is the Kotlin form of SwiftUI List.init(content:): SwiftUI documentation. In Swift it reads:

nonisolated init(@ContentBuilder content: () -> Content)

Topics

Creating a List

fun List(selection: Any, modifier: Modifier = Modifier, onSelectionChange: (Any) -> Unit, content: @Composable () -> Unit)
SwiftUI List.init(selection:content:) · iOS: unavailable (no-op), macOS 14.0+, tvOS: unavailable (no-op), watchOS: unavailable (no-op)
fun List(modifier: Modifier = Modifier, content: @Composable () -> Unit)
SwiftUI List.init(content:)