Hi everyone,
I'm currently working on a native macOS app (built with SwiftUI) and I'm trying to implement Password AutoFill functionality so users can use their saved credentials from Keychain or third-party password managers.
I've gone through Apple's documentation, WWDC sessions, and sample code, but I've noticed that the resources primarily focus on iOS and web implementations. There's very limited guidance specifically for macOS.
I've set up:
- Associated Domains entitlement with the
webcredentials:service - The
apple-app-site-associationfile on my server - TextField with
.textContentType(.username)and SecureField with.textContentType(.password)
However, I'm still not seeing the expected AutoFill behavior on macOS like I would on iOS.
Has anyone successfully implemented Password AutoFill on a native macOS app? Are there any macOS-specific considerations or additional steps required that differ from iOS?
Any guidance, sample code, or pointers to documentation I might have missed would be greatly appreciated.
Hi Albert,
Thank you for the links. After reviewing both documentation pages, I've implemented a complete test following the specifications, but password autofill is not working.
Test Implementation
AASA File (accessible at http://localhost:8080/.well-known/apple-app-site-association):
{
"webcredentials": {
"apps": ["ZW962TGA3F.com.test.PasswordAutofillTest"]
}
}
- ✅ Served with
Content-Type: application/json - ✅ Verified accessible via curl
- ✅ Team ID matches Apple Developer account
Associated Domains Entitlement:
webcredentials:localhost:8080
- ✅ Configured in both Debug and Release entitlements
- ✅ Bundle ID:
com.test.PasswordAutofillTest
SwiftUI Implementation:
TextField("Email", text: $email)
.textContentType(.username)
SecureField("Password", text: $password)
.textContentType(.password)
Authentication Flow:
- App sends POST to
http://localhost:8080/loginwith credentials - Server returns 200 OK
- App displays "Login successful"
- Server logs confirm request received and processed
Result
❌ No "Save Password" prompt appears ❌ No autofill functionality
Critical Question
After researching the documentation you provided, I noticed the Password AutoFill documentation focuses on iOS (UIKit) and mentions AppKit for macOS, but doesn't specifically address SwiftUI on macOS.
The documentation states:
"AppKit-based apps have full support for password and security code AutoFill starting with macOS Big Sur. AppKit has NSTextContentType..."
My test app uses SwiftUI TextField/SecureField, not AppKit NSTextField.
Question: Does password autofill work with SwiftUI on macOS?
Or is it limited to:
- ✅ iOS UIKit apps
- ✅ macOS AppKit apps (NSTextField)
- ✅ Safari/web browsers
- ❌ macOS SwiftUI apps
If SwiftUI is not supported, this would explain why it's not working despite correct configuration.
Environment
- macOS Sequoia 15.1
- Xcode 16.0
- SwiftUI-based macOS app (not AppKit)
- Target: macOS 14.0+
I'm happy to provide the complete test project if helpful. Should I try implementing with AppKit NSTextField instead of SwiftUI to verify if that's the limitation?
Thank you for clarifying whether SwiftUI is supported for password autofill on macOS.
Best regards,
Don Inciso