UIViewController

public extension UIViewController

This is an extension that modifies the navigationBar views according to the Design System. It represents the component AppBar - Top.

Examples of usage:

   viewController.configure(actionRight: [iconButton, customView])
   viewController.configure(actionLeft: iconButton)

Requires

It’s necessary to configure the Design System with a theme or fatalError will be raised.

   DesignSystem().configure(with: AvailableTheme)
  • Sets the action right items for the navigation bar The items can be any of UIView, including other components from the Design System The max number of items that can be configured is 3.

    Declaration

    Swift

    func configure(appBarActionRight items: [UIView])

    Parameters

    items

    an array of UIViews

  • Sets the action left item for the navigation bar If there’s a ‘back’ action already in use, it overrides it The item can be any UIView, including other componentes from the Design System

    Declaration

    Swift

    func configure(appBarActionLeft item: UIView)

    Parameters

    item

    an UIView

  • Sets the content type for the navigation bar’s center view

    Declaration

    Swift

    func configure(appBarContentType item: AppBarContentType)

    Parameters

    item

    an option from AppBarContentType, with a string value (text), image (media) or NatLogo

  • Sets rightBarButtonItems for the navigation bar

    Example of usage:

            let barItems: [UIBarButtonItem] = [UIBarButtonItem(icon: .outlinedActionCalendar, action: nil, target: nil)]
            viewController.configure(buttons: barItems)
    

    Declaration

    Swift

    @available(*, deprecated, message: "Use configure(appBarActionRight items:﹚ instead")
    func configure(buttons: [UIBarButtonItem])

    Parameters

    buttons

    an array of UIBarButtonItems