Uitextfield 通知 xcode 12

Uitextfield notificaton xcode 12

uitextfield怎么会出现message must be filled first before it can be executed? 我已经搜索 Google 但没找到。

my design

您的意思是显示一条消息,说明在前进之前必须填写文本字段? 如果是这样,请在每个 textField

上使用 if 语句
if namaField.text == "" || alamatField.text == "" || phoneField.text == "" {
    let alertController = UIALertController(title: "Enter all fields", preferredStyle: .alert)
    let okayAction = UIAlertAction(title: "Okay", style: .default, handler: { action in
        self.dismiss(animated: true, completion: nil)
    })
    alert.addAction(okayAction)
    self.present(alert, animated: true)
}