> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/ios/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/ios/swiftui/control/securefield.md).

# SecureField

用於輸入密碼時。

```swift
import SwiftUI
import PlaygroundSupport

// live view
struct ContentView: View {
    // view states
    @State private var username = ""
    @State private var password = ""
    // view body
    var body: some View {
        VStack {
            TextField("Username", text: $username)
            SecureField("Password", text: $password)  // SecureField
        }.textFieldStyle(RoundedBorderTextFieldStyle())
    }
}

PlaygroundPage.current.setLiveView(ContentView())
```

{% tabs %}
{% tab title="📘 參考" %}
\*
{% endtab %}

{% tab title="Second Tab" %}

{% endtab %}
{% endtabs %}
