Skip to content
Passcode Field preview
Rendered from the SwiftUI source on this page.

Passcode Field

From syxUI — written for both platforms, not translated between them.

A six-dot passcode entry field.

Inputs · SwiftUI · iOS 17

  • inputs
  • swiftui

The actual source

PinField.swift
// Passcode Field · syxUI · https://syxui.dev/components/inp-pin
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

// Passcode dots field
struct PinField: View {
    var body: some View {
        VStack(spacing: 16) {
            Text("Enter Passcode").font(.system(size: 15, weight: .medium))
            HStack(spacing: 18) {
                ForEach(0..<6, id: \.self) { i in
                    Circle().stroke(Color.primary.opacity(0.3), lineWidth: 1.5).frame(width: 15, height: 15).overlay { if i < 4 { Circle().fill(Color.primary).frame(width: 15, height: 15) } }
                }
            }
        }.frame(width: 280)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17