Use a SecureField when you want behavior similar to a TextField, but you don’t want the user’s text to be visible. Typically, you use this for entering passwords and other sensitive information.
A SecureField uses a binding to a string value, and a closure that executes when the user commits their edits, such as by pressing the Return key. The field updates the bound string on every keystroke or other edit, so you can read its value at any time from another control, such as a Done button.
The following example shows a SecureField bound to the string password. If the user commits their edit in the secure field, the onCommit closure sends the password string to a handleLogin() method.
A secure field may be provided an explicit prompt to guide users on what text they should provide. The context in which a secure field appears determines where and when a prompt and label may be used. For example, a form on macOS will always place the label alongside the leading edge of the field and will use a prompt, when available, as placeholder text within the field itself. In the same context on iOS, the prompt or label will be used as placeholder text depending on whether a prompt is provided.
Sets the text content type for this view, which the system uses to offer suggestions while the user enters text on an iOS or tvOS device.
テキスト内容型をこのビューに対して設定します、それはシステムが提案を申し出るために使います、ユーザがテキストをiOSまたはtvOSデバイス上で入力する間に。
Sets the text content type for this view, which the system uses to offer suggestions while the user enters text on macOS.
テキスト内容型をこのビューに対して設定します、それはシステムが提案を申し出るために使います、ユーザがテキストをmacOS上で入力する間に。
Sets the text content type for this view, which the system uses to offer suggestions while the user enters text on a watchOS device.
テキスト内容型をこのビューに対して設定します、それはシステムが提案を申し出るために使います、ユーザがテキストをwatchOSデバイス上で入力する間に。