Files
firebase-ios-sdk/FirebaseAuth/Sources/Swift/Utilities/AuthUIDelegate.swift
T

56 lines
2.4 KiB
Swift
Raw Normal View History

2023-05-11 13:27:34 -07:00
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#if os(iOS) || os(tvOS) || os(visionOS)
2023-05-11 13:27:34 -07:00
import Foundation
2023-05-12 07:37:16 -07:00
import UIKit
2023-05-11 13:27:34 -07:00
/// A protocol to handle user interface interactions for Firebase Auth.
///
/// This protocol is available on iOS, macOS Catalyst, and tvOS only.
2023-05-11 13:27:34 -07:00
@objc(FIRAuthUIDelegate) public protocol AuthUIDelegate: NSObjectProtocol {
/// If implemented, this method will be invoked when Firebase Auth needs to display a view
/// controller.
/// - Parameter viewControllerToPresent: The view controller to be presented.
/// - Parameter flag: Decides whether the view controller presentation should be animated.
/// - Parameter completion: The block to execute after the presentation finishes.
/// This block has no return value and takes no parameters.
2023-05-11 13:27:34 -07:00
@objc(presentViewController:animated:completion:)
func present(_ viewControllerToPresent: UIViewController,
animated flag: Bool,
completion: (() -> Void)?)
/// If implemented, this method will be invoked when Firebase Auth needs to display a view
/// controller.
/// - Parameter flag: Decides whether removing the view controller should be animated or not.
/// - Parameter completion: The block to execute after the presentation finishes.
/// This block has no return value and takes no parameters.
2023-05-11 13:27:34 -07:00
@objc(dismissViewControllerAnimated:completion:)
func dismiss(animated flag: Bool, completion: (() -> Void)?)
}
// Extension to support default argument variations.
extension AuthUIDelegate {
func present(_ viewControllerToPresent: UIViewController,
animated flag: Bool,
completion: (() -> Void)? = nil) {
return present(viewControllerToPresent, animated: flag, completion: nil)
}
func dismiss(animated flag: Bool, completion: (() -> Void)? = nil) {
return dismiss(animated: flag, completion: nil)
}
}
#endif