UIViewController
public extension UIViewController
ViewController+ActionSheet is used to present an action sheet.
Version
1.9.15Date
28/03/2023-
Show an action sheet
Declaration
Swift
func showActionSheet(from view: UIView, withTitle title: String?, message: String?, and items: [ActionSheetItem], under interfaceIdiom: UIUserInterfaceIdiom = UIDevice.current.userInterfaceIdiom)Parameters
titleThe title of the action sheet
messageThe message of the action sheet
itemsA list of actions
viewThe view that calls this action sheet. An arrow will be pointed to the center of this view on iPad.
interfaceIdomThe interface idom of the device.
-
Whether the view controller is a root view controller or not.
Declaration
Swift
var isRootViewController: Bool { get } -
The completion block won’t be called if the actual action is popping a view controller
Declaration
Swift
func back(withAnimation shouldAnimate: Bool = true, completion: @escaping () -> Void = {})Parameters
shouldAnimateWhether or not there should be a back animation.
completionCompletion block after finishing the transaction
-
Setup the back button
Declaration
Swift
func setupBackButton(withBackTitle backTitle: String? = nil, withBackImage backImage: UIImage? = nil, withCancelTitle cancelTitle: String? = nil, withCancelImage cancelImage: UIImage? = nil)Parameters
backTitleThe title of the back button if there is a previous view controller.
backImageThe image of the back button if there is a previous view controller.
cancelTitleThe title of the cancel button if the current view controller is the root view controller.
cancelImageThe image of the cancel button if the current view controller is the root view controller.
-
Perform the back action
Declaration
Swift
@objc func backAction() -
The top view controller from the current view.
Declaration
Swift
var topViewController: UIViewController? { get }
UIViewController Extension Reference