Help getting user input from a text field

I feel like I’m overlooking something obvious here. Why does this result in a null value, and how can I fix it to return the entered value?

var titleInput = new Alert()
titleInput.title = "Input:"

let title = await titleInput.presentAlert()



Worked for me after typing in “abc”.

Are you pressing return at the end or selecting cancel?