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.
-
A unique identifier for each
SideBarItemModelinstance, generated usingUUID()Declaration
Swift
public var id: UUID -
A
Stringrepresenting the title of the side bar itemDeclaration
Swift
public var title: String -
An optional
Imagethat represents the icon of the side bar item.Declaration
Swift
public var icon: Image? -
An optional
Imagethat represents a icon of the side bar item when it was selected.Declaration
Swift
public var filledIcon: Image? -
An optional
Stringrepresenting the subtitle of the side bar item.Declaration
Swift
public var subtitle: String? -
An optional
Imagethat represents an accessory icon for the side bar item.Declaration
Swift
public var accessoryIcon: Image? -
A
Boolindicating whether the side bar item is invisible when the SideBar was in view mode. It is set tofalseby default.Declaration
Swift
public var isInvisible: Bool -
An optional array of
SideBarItemModelinstances representing the children items of the side bar item.Declaration
Swift
public var children: [SideBarItemModel]? { get set } -
A
Boolindicating whether the side bar item is a section or not. It is set tofalseby default and will set to true if children is not empty when initializingDeclaration
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
titleA
Stringrepresenting the title of the side bar itemiconAn optional
Imagethat represents the icon of the side bar item.filledIconAn optional
Imagethat represents a icon of the side bar item when it was selected.subtitleAn optional
Stringrepresenting the subtitle of the side bar item.accessoryIconAn optional
Imagethat represents an accessory icon for the side bar item.childrenAn optional array of
SideBarItemModelinstances representing the children items of the side bar item.isSectionA
Boolindicating whether the side bar item is a section or not. It is set tofalseby default and will set to true if children is not empty and don’t set it explicitly.isInvisibleA
Boolindicating whether the side bar item is hidden or not in view mode. It is set tofalseby default. -
An equality operator method that compares two
SideBarItemModelinstances based on theiridproperty.Declaration
Swift
public static func == (lhs: SideBarItemModel, rhs: SideBarItemModel) -> Bool