authorizationController
A value provided in the SwiftUI environment that views can use to perform authorization requests.
Declaration
var authorizationController: AuthorizationController { get }Discussion
For example, you can perform authorization requests when the user taps a button:
struct AuthorizationControllerExample: View {
@Environment(\.authorizationController) private var authorizationController
var body: some View {
Button("Sign In") {
Task {
do {
async let requests = authorizationRequests() // defined elsewhere
let result = try await authorizationController
.performRequests(requests)
switch result {
// code to handle the authorization result
}
} catch {
// code to handle the authorization error
}
}
}
}
}