SystemPasswordView

A system-style password input view for iOS


License
MIT
Install
pod try SystemPasswordView

Documentation

SystemPasswordView

A system-style password input view for iOS, built with SwiftUI.

Platform Swift iOS CocoaPods SPM

Features

  • System-style password input interface
  • Haptic feedback
  • Error animation with shake effect
  • Native SwiftUI implementation

Screenshots

Requirements

  • iOS 17.0+
  • Swift 6.0+
  • Xcode 15.0+

Installation

Swift Package Manager

Add the following to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/wwzzyying/SystemPasswordView.git", from: "0.1.5")
]

Or add it through Xcode:

  1. File > Add Packages...
  2. Enter package URL: https://github.com/wwzzyying/SystemPasswordView.git
  3. Select "Up to Next Major Version" with "0.1.5"

CocoaPods

Add the following line to your Podfile:

pod 'SystemPasswordView'

Then run:

pod install

Usage

import SystemPasswordView

struct ContentView: View {
    @State private var showPasswordView = false
    
    var body: some View {
        Button("Show Password View") {
            showPasswordView = true
        }
        .sheet(isPresented: $showPasswordView) {
            SystemPasswordView(
                isPresented: $showPasswordView,
                title: "Enter Password",
                onComplete: { password in
                    // Validate password here
                    return password == "123456"
                }
            )
        }
    }
}

Example

The password view will show a shake animation and haptic feedback when the password is incorrect:

SystemPasswordView(
    isPresented: $showPasswordView,
    title: "Enter Password") { password in
        // Return true if password is correct
        // Return false to trigger error animation
        return password == "123456"
    }

Author

Jyuuroku Wu, jyuurokuu@gmail.com

License

SystemPasswordView is available under the MIT license. See the LICENSE file for more info.