UIViewController

class UIViewController : UIResponder, NSCoding, UIAppearanceContainer, UITraitEnvironment, UIContentContainer, UIFocusEnvironment

This extesion adds some useful functions to UIViewController.

  • Use this in viewWillAppear(_:)

    Declaration

    Swift

    public func smoothlyDeselectRows(tableView: UITableView)

    Parameters

    tableView

    UITableView to be delected.

  • Presents a UIAlertController with a title, message and a set of actions.

    Declaration

    Swift

    public func present(title: String, message: String, actions: [UIAlertAction], alertType: UIAlertController.Style = .alert)

    Parameters

    title

    The title of the UIAlerController.

    message

    An optional String for the UIAlertController’s message.

    actions

    An array of actions that will be added to the UIAlertController.

    alertType

    The style of the UIAlertController.

  • Sets the tab bar visible or not. This cannot be called before viewDidLayoutSubviews(), because the frame is not set before this time.

    Declaration

    Swift

    public func setTabBarVisible(_ visible: Bool, animated: Bool, duration: TimeInterval = 0.3)

    Parameters

    visible

    Set if visible.

    animated

    Set if the transition must be animated.

  • Returns if the tab bar is visible.

    Declaration

    Swift

    public func isTabBarVisible() -> Bool

    Return Value

    Returns if the tab bar is visible.