---
description: 用於輸入密碼時。
---

# 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 %}
