UIViewController
public extension UIViewController
extension UIViewController: AlertViewPresenter
-
Loads the childViewController into the specified containerView.
It can be done after self’s view is initialized, as it uses constraints to determine the childViewController size. Take into account that self will retain the childViewController, so if for any other reason the childViewController is retained in another place, this would lead to a memory leak. In that case, one should call unloadViewController().
Declaration
Swift
func load(childViewController: UIViewController, into containerView: UIView, with insets: UIEdgeInsets = .zero, in viewPositioning: ViewPositioning = .front, layout: LayoutMode = .constraints, respectSafeArea: Bool = false)Parameters
childViewControllerThe controller to load.
intoThe containerView into which the controller will be loaded.
viewPositioningBack or Front. Default: Front
-
Unloads a childViewController and its view from its parentViewController.
Declaration
Swift
func unloadFromParentViewController() -
Unloads all childViewController and their view from self.
Declaration
Swift
func unloadChildViewControllers()
-
Configures the navigation bar to have a particular image as back button.
Warning
This function must be called when self is inside a navigation controller. If not it will arise a runtime fatal error.Declaration
Swift
func setNavigationBarBackButton(_ image: UIImage)Parameters
imageThe image of the back button.
-
Configures the navigation bar color.
Warning
This function must be called when self is inside a navigation controller. If not it will arise a runtime fatal error.Declaration
Swift
func setNavigationBarColor(_ color: UIColor)Parameters
colorThe new color of the navigation bar. This represents the navigation bar background color.
-
Configures the navigation bar tint color.
Warning
This function must be called when self is inside a navigation controller. If not it will arise a runtime fatal error.Declaration
Swift
func setNavigationBarTintColor(_ color: UIColor)Parameters
colorThe new tint color of the navigation bar. This represents the color of the left and right button items.
-
Configures the navigation bar style.
Warning
This function must be called when self is inside a navigation controller. If not it will arise a runtime fatal error.Declaration
Swift
func setNavigationBarStyle(_ style: UIBarStyle)Parameters
styleThe new style of the navigation bar.
-
Sets a collection of buttons as the navigation bar left buttons.
Declaration
Swift
func setNavigationLeftButtons(_ buttons: [UIBarButtonItem])Parameters
buttonsthe Array of buttons to use.
-
Sets a collection of buttons as the navigation bar right buttons.
Declaration
Swift
func setNavigationRightButtons(_ buttons: [UIBarButtonItem])Parameters
buttonsthe Array of buttons to use.
-
Adds and configures a label to use as title of the navigation bar.
Declaration
Swift
func setNavigationBarTitle(_ title: String, font: UIFont, color: UIColor)Parameters
titlethe string of the label.
fontthe font to use for the label.
colorthe color of the text.
-
Adds an ImageView with the image passed as the titleView of the navigation bar.
Declaration
Swift
func setNavigationBarTitleImage(_ image: UIImage)Parameters
imageThe image to set as title.
-
Presents a new alert. The alert’s information is stored in the ErrorAlertViewModel passed by parameter.
Warning
The closure is fired when the alert is shown, it is not related to the dismiss/confirmation. Dismiss and confirmation callbacks can be set on theErrorAlertViewModel.Seealso
ErrorAlertViewModelDeclaration
Swift
public func presentAlert(_ alertViewModel: ErrorAlertViewModel, completion: (() -> Void)? = .none)Parameters
alertViewModelErrorAlertViewModel.
completionClosure that fires when the alert is shown.
-
Presents a new alert. The alert’s information is stored in the ConfirmationAlertViewModel passed by parameter.
Warning
The closure is fired when the alert is shown, it is not related to the dismiss/confirmation. Dismiss and confirmation callbacks can be set on theConfirmationAlertViewModel.Seealso
ConfirmationAlertViewModel.Declaration
Swift
public func presentAlert(_ alertViewModel: ConfirmationAlertViewModel, completion: (() -> Void)? = .none)Parameters
alertViewModelConfirmationAlertViewModel.
completionClosure that fires when the alert is shown.
UIViewController Extension Reference