SideBarItemModel

public struct SideBarItemModel : Identifiable, Hashable, Equatable

The SideBarItemModel struct is a data model that represents a side bar item . It conforms to the Identifiable, Hashable, and Equatable protocols, which allow it to be used in collections and compared for equality.

  • id

    A unique identifier for each SideBarItemModel instance, generated using UUID()

    Declaration

    Swift

    public var id: UUID
  • A String representing the title of the side bar item

    Declaration

    Swift

    public var title: String
  • An optional Image that represents the icon of the side bar item.

    Declaration

    Swift

    public var icon: Image?
  • An optional Image that represents a icon of the side bar item when it was selected.

    Declaration

    Swift

    public var filledIcon: Image?
  • An optional String representing the subtitle of the side bar item.

    Declaration

    Swift

    public var subtitle: String?
  • An optional Image that represents an accessory icon for the side bar item.

    Declaration

    Swift

    public var accessoryIcon: Image?
  • A Bool indicating whether the side bar item is invisible when the SideBar was in view mode. It is set to false by default.

    Declaration

    Swift

    public var isInvisible: Bool
  • An optional array of SideBarItemModel instances representing the children items of the side bar item.

    Declaration

    Swift

    public var children: [SideBarItemModel]? { get set }
  • A Bool indicating whether the side bar item is a section or not. It is set to false by default and will set to true if children is not empty when initializing

    Declaration

    Swift

    public var isSection: Bool
  • Public initializer for SideBarItemModel.

    Declaration

    Swift

    public init(title: String, icon: Image? = nil, filledIcon: Image? = nil, subtitle: String? = nil, accessoryIcon: Image? = nil, children: [SideBarItemModel]? = nil, isSection: Bool = false, isInvisible: Bool = false)

    Parameters

    title

    A String representing the title of the side bar item

    icon

    An optional Image that represents the icon of the side bar item.

    filledIcon

    An optional Image that represents a icon of the side bar item when it was selected.

    subtitle

    An optional String representing the subtitle of the side bar item.

    accessoryIcon

    An optional Image that represents an accessory icon for the side bar item.

    children

    An optional array of SideBarItemModel instances representing the children items of the side bar item.

    isSection

    A Bool indicating whether the side bar item is a section or not. It is set to false by default and will set to true if children is not empty and don’t set it explicitly.

    isInvisible

    A Bool indicating whether the side bar item is hidden or not in view mode. It is set to false by default.

  • A method that allows the SideBarItemModel instances to be used in hash-based collections. It combines the id and title properties to generate a hash value.

    Declaration

    Swift

    public func hash(into hasher: inout Hasher)
  • An equality operator method that compares two SideBarItemModel instances based on their id property.

    Declaration

    Swift

    public static func == (lhs: SideBarItemModel, rhs: SideBarItemModel) -> Bool