IosAppleSignIn

constructor(anchor: () -> UIWindow, nonceSource: () -> String = { newRawNonce() })(source)

Parameters

anchor

the window to present over. Required, not defaulted: every way of finding the key window from a library (UIApplication.keyWindow, .windows) is deprecated and wrong in a multi-scene app. The host has the window; the host passes it.

The weak-delegate trap

ASAuthorizationController holds delegate and presentationContextProvider weakly. A delegate allocated inside a suspend fun has no other owner, so ARC frees it the moment the function suspends — the sheet stays on screen, no callback ever fires, and the coroutine hangs forever with no error to log. inFlight and inFlightController are the strong references that stop that, and they are cleared only once the flow has actually ended. This is the same hazard as PKPaymentAuthorizationController; it is a property of the delegate pattern, not of one API.