See Part 1 for basics of Passkeys.

Here's the code. Three main pieces: view model (handles auth logic), UI views (presents to users), and error handling.




The Authentication View Model


This coordinates between iOS's passkey system and your server.



import SwiftUI
import AuthenticationServices

@MainActor
class PasskeyAuthViewModel:...