A system-style password input view for iOS, built with SwiftUI.
- System-style password input interface
- Haptic feedback
- Error animation with shake effect
- Native SwiftUI implementation
- iOS 17.0+
- Swift 6.0+
- Xcode 15.0+
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:
- File > Add Packages...
- Enter package URL:
https://github.com/wwzzyying/SystemPasswordView.git
- Select "Up to Next Major Version" with "0.1.5"
Add the following line to your Podfile:
pod 'SystemPasswordView'
Then run:
pod install
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"
}
)
}
}
}
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"
}
Jyuuroku Wu, jyuurokuu@gmail.com
SystemPasswordView is available under the MIT license. See the LICENSE file for more info.