Skip to content

Instantly share code, notes, and snippets.

@mbrandonw
Last active September 15, 2021 15:38
Show Gist options
  • Select an option

  • Save mbrandonw/31cd1dc0872ac0a090c0981af432752a to your computer and use it in GitHub Desktop.

Select an option

Save mbrandonw/31cd1dc0872ac0a090c0981af432752a to your computer and use it in GitHub Desktop.

FB9627501

In previous betas of Xcode 13 a purple runtime warning would appear when using the alert/confirmationDialog APIs incorrectly. For example, this:

struct ContentView: View {
  var body: some View {
    Text("Hi")
      .alert(
        "Alert",
        isPresented: .constant(true),
        presenting: Int?.none,
        actions: { _ in 
          Button("Ok") { }
        }
      )
  }
}

Would show a warning:

🟣 Attempting to present an alert without any data. The data parameter must be non-nil when isPresented is true.

But now no warning appears and so it can be confusing why the alert/confirmationDialog is presented with invalid data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment