Compose SwiftUIv0.4.0
esc
GuideAPIGitHub
View modifier

alert(_:)

Presents an alert.

iOS 17.0+macOS 14.0+tvOS 17.0+watchOS 10.0+
fun Modifier.alert(title: String, isPresented: Boolean, onIsPresentedChange: (Boolean) -> Unit, actions: @Composable () -> Unit): Modifier

Overview

Modifier.alert(title = "…", isPresented = true, onIsPresentedChange = { value -> })

This is the Kotlin form of SwiftUI View.alert(_:isPresented:actions:): SwiftUI documentation. In Swift it reads:

nonisolated func alert<S, A>(_ title: S, isPresented: Binding<Bool>, @ContentBuilder actions: () -> A) -> some View where S : StringProtocol, A : View

Topics

Overloads

fun Modifier.alert(title: String, isPresented: Boolean, onIsPresentedChange: (Boolean) -> Unit, actions: @Composable () -> Unit, message: @Composable () -> Unit): Modifier
SwiftUI View.alert(_:isPresented:actions:message:)
fun Modifier.alertIsPresented(title: String, isPresented: Boolean, onIsPresentedChange: (Boolean) -> Unit, actions: @Composable () -> Unit): Modifier
SwiftUI View.alert(_:isPresented:actions:)
fun Modifier.alert(titleKey: LocalizedKey, isPresented: Boolean, onIsPresentedChange: (Boolean) -> Unit, actions: @Composable () -> Unit, message: @Composable () -> Unit): Modifier
SwiftUI View.alert(_:isPresented:actions:message:)
fun Modifier.alert(titleKey: LocalizedKey, isPresented: Boolean, onIsPresentedChange: (Boolean) -> Unit, actions: @Composable () -> Unit): Modifier
SwiftUI View.alert(_:isPresented:actions:)
fun Modifier.alertIsPresented(titleResource: LocalizedKey, isPresented: Boolean, onIsPresentedChange: (Boolean) -> Unit, actions: @Composable () -> Unit, message: @Composable () -> Unit): Modifier
SwiftUI View.alert(_:isPresented:actions:message:)
fun Modifier.alert(title: String, isPresented: Boolean, onIsPresentedChange: (Boolean) -> Unit, actions: @Composable () -> Unit): Modifier
SwiftUI View.alert(_:isPresented:actions:)
fun Modifier.alertIsPresented(titleResource: LocalizedKey, isPresented: Boolean, onIsPresentedChange: (Boolean) -> Unit, actions: @Composable () -> Unit): Modifier
SwiftUI View.alert(_:isPresented:actions:)
fun Modifier.alertIsPresented(title: String, isPresented: Boolean, onIsPresentedChange: (Boolean) -> Unit, actions: @Composable () -> Unit, message: @Composable () -> Unit): Modifier
SwiftUI View.alert(_:isPresented:actions:message:)