New initializer for ASWebAuthenticationSession

I have noticed that there is a new initializer for ASWebAuthenticationSession in macOS 14.4. The standard initializer has been deprecated without further info.

The new initializer looks as follows:

init(url: URL, callback: ASWebAuthenticationSession.Callback, completionHandler: ASWebAuthenticationSession.CompletionHandler)

This initializer takes a callback object for class ASWebAuthenticationSession.Callback.

But this class cannot be initialized and also not be subclassed. When you try to do this there will be the following error in Xcode 'init()' is unavailable

The documentation also does not give any hint on how to use it, it just defines 2 class methods and a method called func matchesURL(URL) -> Bool which could mean that by using this method you could match any arbitrary URL to continue the process.

Has anyone figured out what to do with this?

Answered by Systems Engineer in 783531022

The new ASWebAuthenticationSession.Callback type can be initialized with the static members .customScheme() or .https(host:path:). The .customScheme() option is equivalent to the scheme passed to the previous initializer.

Accepted Answer

The new ASWebAuthenticationSession.Callback type can be initialized with the static members .customScheme() or .https(host:path:). The .customScheme() option is equivalent to the scheme passed to the previous initializer.

New initializer for ASWebAuthenticationSession
 
 
Q