Bar

The bar is responsible for conveying the current page position of a TabmanViewController, and providing the user with the ability to interact with the page view controller indirectly. In Tabman, this comes in the form of TMBar, a protocol that is restricted to UIView types. TMBar instances can be added to a TabmanViewController and are then internally managed by the view controller.

The default TMBar provided in Tabman is the TMBarView, a flexible view which contains the following core components:

  • Layout (TMBarLayout) - responsible for dictating the layout and display of the bar.
  • Buttons (TMBarButton) - interactable views that directly map to each bar item.
  • Indicator (TMBarIndicator) - view that indicates the currently active item.

These components are defined with generic type constraints on TMBarView, providing a huge amount of customization and flexibility. In all likelyhood you will not have to create your own TMBar but if required it is absolutely possible.

  • TMBar is a protocol that is constrained to UIView types. Conforming view types can be added to and displayed in a TabmanViewController.

    TMBar is expected to display a TMBarItem collection provided by a data source visually in some form, and also respond to the current page position.

    The default implementation of TMBar in Tabman is TMBarView.

    Declaration

    Swift

    public protocol TMBar : UIView, BaseTMBar
  • TMBarView is the default Tabman implementation of TMBar. A UIView that contains a TMBarLayout which displays a collection of TMBarButton, and also a TMBarIndicator. The types of these three components are defined by constraints in the TMBarView type definition.

    Declaration

    Swift

    open class TMBarView<Layout, Button, Indicator> : UIView, TMTransitionStyleable, TMBarLayoutParent where Layout : TMBarLayout, Button : TMBarButton, Indicator : TMBarIndicator
    extension TMBarView: TMBar
  • Definition of an item that can be displayed in a TMBar.

    Properties of a TMBarItemable are optionally displayed in a TMBar depending on the layout / configuration.

    Tabman adds extensions to UIKit components to natively support TMBarItemable, such as UINavigationItem and UITabBarItem. Therefore for example, simply returning a UIViewController navigationItem as a TMBarItemable is fully supported.

    Declaration

    Swift

    public protocol TMBarItemable : AnyObject
  • Default TMBarItemable that can be displayed in a TMBar.

    Declaration

    Swift

    open class TMBarItem : TMBarItemable
  • Data source to a TMBar that is primarily responsible for providing a bar with contents.

    Declaration

    Swift

    public protocol TMBarDataSource : AnyObject
  • Delegate to a TMBar that is primarily responsible for handling user interaction within the bar.

    Declaration

    Swift

    public protocol TMBarDelegate : AnyObject
  • Bar which mimicks the appearance of a UIKit UINavigationBar / UITabBar.

    Contains an internal TMBar and forwards on all bar responsibility to this instance.

    Declaration

    Swift

    public final class TMSystemBar : UIView
    extension TMSystemBar: TMBar
  • Bar which can be hidden using animated transitions.

    Supports manual show/hide triggering and also automatic triggers such as time.

    Declaration

    Swift

    open class TMHidingBar : UIView
    extension TMHidingBar: TMBar