swift / swiftui

NexAuthKit

Package.swift
.package(url: "https://github.com/nexabase/nexauth-swift", from: "0.1.0")
LoginView.swift
import NexAuthKit

NexAuthView(
    auth: NexAuth(publishableKey: "pk_live_..."),
    methods: [.whatsapp, .google, .passkey],
    branding: .init(
        appName: "Acme Health",
        primaryColor: Color(hex: 0x7C6CFF),
        securedBy: true
    ),
    onSuccess: { session in path.append(.home) }
)
otp input
NexOtpField(
    length: 6,
    style: .outlined,             // .outlined | .filled | .underline
    textContentType: .oneTimeCode, // auto — iOS OTP autofill
    onComplete: { code in auth.otp.verify(...) }
)

Session persists in Keychain; auth.session is an @Published/AsyncStream source.