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
SideBarItemModel
instance, generated usingUUID()
Declaration
Swift
public var id: UUID
-
A
String
representing the title of the side bar itemDeclaration
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 tofalse
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 tofalse
by 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
title
A
String
representing the title of the side bar itemicon
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 tofalse
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 tofalse
by default. -
An equality operator method that compares two
SideBarItemModel
instances based on theirid
property.Declaration
Swift
public static func == (lhs: SideBarItemModel, rhs: SideBarItemModel) -> Bool