title: Using UITextInputPasswordRules in SwiftUI
body: <p>I want to use the UITextInputPasswordRules in my SwiftUI Code for validating a password from the user.</p>
  <p>The <strong>Swift</strong> code would look like this Codesnippet:</p>
  <pre><code>let newPasswordTextField = UITextField()
  newPasswordTextField.passwordRules = UITextInputPasswordRules(descriptor: &quot;required: lower; required: upper; required: digit; required: special; allowed: unicode; minlength: 10;&quot;)
  </code></pre>
  <p>My <strong>SwiftUI</strong> Code looks like that, so far:</p>
  <pre><code>struct CustomPasswordTextField: View {
      let passwordRuleDescription: String = &quot;required: lower; required: upper; required: digit; required: special; allowed: unicode; minlength: 10;&quot;
      var placeholder: Text
      @Binding var text: String
  
      var body: some View {
          ZStack(alignment: .leading) {
              if text.isEmpty { placeholder }
              SecureField(&quot;&quot;, text: $text)
          }
      }
  }
  </code></pre>
  <p>How can I apply the passwordRuleDescription to the <code>SecureField(&quot;, text: $text&quot;)</code>?</p>