Library / Outcomes & notifications

Warning (needs attention)

Something needs attention but is not fatal: low battery in a session, unsaved changes, weak signal.

0ms 100ms 200ms 300ms 400ms
Feel
Two taps with a falling feel — heavier than success, softer than error.
APIs
.sensoryFeedback(.warning)UINotificationFeedbackGenerator(.warning)
Minimum OS
iOS 17+ / iOS 10+
Raw .md
SwiftUI (iOS 17+)
import SwiftUI

struct RecordingView: View {
    @State private var storageAlmostFull = false

    var body: some View {
        VStack {
            Text("Recording…")
            if storageAlmostFull {
                Label("Less than 1 minute of storage left",
                      systemImage: "exclamationmark.triangle.fill")
                    .foregroundStyle(.orange)
            }
        }
        .sensoryFeedback(.warning, trigger: storageAlmostFull) { _, new in new }
        .task {
            try? await Task.sleep(for: .seconds(3))
            withAnimation { storageAlmostFull = true }
        }
    }
}
Copied