updated didSet

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-30 18:09:18 -05:00
parent ba8e557cd0
commit 816bf2f951
2 changed files with 16 additions and 16 deletions

View File

@ -63,25 +63,25 @@ extension Tabs {
}
///orientation of the tabs
open var orientation: Tabs.Orientation = .horizontal { didSet { setNeedsUpdate() } }
open var orientation: Tabs.Orientation = .horizontal { didSet { if oldValue != orientation { setNeedsUpdate() } } }
///Size for tab
open var size: Tabs.Size = .medium { didSet { setNeedsUpdate() } }
open var size: Tabs.Size = .medium { didSet { if oldValue != size { setNeedsUpdate() } } }
///Text position left or center
open var textAlignment: TextAlignment = .left { didSet { setNeedsUpdate() } }
open var textAlignment: TextAlignment = .left { didSet { if oldValue != textAlignment { setNeedsUpdate() } } }
///Sets the Position of the Selected/Hover Border Accent for All Tabs.
open var indicatorPosition: Tabs.IndicatorPosition = .bottom { didSet { setNeedsUpdate() } }
open var indicatorPosition: Tabs.IndicatorPosition = .bottom { didSet { if oldValue != indicatorPosition { setNeedsUpdate() } } }
///If provided, it will set fixed width for this Tab.
open var width: CGFloat? { didSet { setNeedsUpdate() } }
open var width: CGFloat? { didSet { if oldValue != width { setNeedsUpdate() } } }
///The text label of the tab.
open var text: String = "Tab" { didSet { setNeedsUpdate() } }
open var text: String = "Tab" { didSet { if oldValue != text { setNeedsUpdate() } } }
///Minimum width for the tab
open var minWidth: CGFloat = 44.0 { didSet { setNeedsUpdate() } }
open var minWidth: CGFloat = 44.0 { didSet { if oldValue != minWidth { setNeedsUpdate() } } }
//--------------------------------------------------
// MARK: - Configuration

View File

@ -90,31 +90,31 @@ open class Tabs: View {
open var orientation: Orientation = .horizontal { didSet { if oldValue != orientation { setNeedsUpdate() } } }
/// When true, Tabs will have border line. If false is passed then the border line won't be visible.
open var borderLine: Bool = true { didSet { setNeedsUpdate() } }
open var borderLine: Bool = true { didSet { if oldValue != borderLine { setNeedsUpdate() } } }
/// It will fill the Tabs to the width of the compoent and all Tabs will be in equal width when orientation is horizontal. This is recommended when there are no more than 2-3 tabs.
open var fillContainer: Bool = false { didSet { setNeedsUpdate() } }
open var fillContainer: Bool = false { didSet { if oldValue != fillContainer { setNeedsUpdate() } } }
/// When true, Tabs will be sticky to top of page, when orientation is vertical.
open var indicatorFillTab: Bool = false { didSet { setNeedsUpdate() } }
open var indicatorFillTab: Bool = false { didSet { if oldValue != indicatorFillTab { setNeedsUpdate() } } }
/// Sets the Position of the Selected/Hover Border Accent for All Tabs, only for Horizontal Orientation
open var indicatorPosition: IndicatorPosition = .bottom { didSet { setNeedsUpdate() } }
open var indicatorPosition: IndicatorPosition = .bottom { didSet { if oldValue != indicatorPosition { setNeedsUpdate() } } }
/// Minimum Width for All Tabs, when orientation is horizontal.
open var minWidth: CGFloat = 44.0 { didSet { setNeedsUpdate() } }
open var minWidth: CGFloat = 44.0 { didSet { if oldValue != minWidth { setNeedsUpdate() } } }
/// If set to 'scroll', Tabs can be overflow and scrollable. With 'none', tabs will not overflow and labels will be wrapped to multiple lines if the label text is long.
open var overflow: Overflow = .scroll { didSet { setNeedsUpdate() } }
open var overflow: Overflow = .scroll { didSet { if oldValue != overflow { setNeedsUpdate() } } }
/// The initial Selected Tab's index and is set once a Tab is clicked
open var selectedIndex: Int = 0 { didSet { setNeedsUpdate() } }
open var selectedIndex: Int = 0 { didSet { if oldValue != selectedIndex { setNeedsUpdate() } } }
/// Determines the size of the Tabs TextStyle
open var size: Size = .medium { didSet { setNeedsUpdate() } }
open var size: Size = .medium { didSet { if oldValue != size { setNeedsUpdate() } } }
/// When true, Tabs will be sticky to top of page, when orientation is vertical.
open var sticky: Bool = false { didSet { setNeedsUpdate() } }
open var sticky: Bool = false { didSet { if oldValue != sticky { setNeedsUpdate() } } }
/// Array of ``TabModel`` you are wanting to show.
open var tabModels: [TabModel] = [] { didSet { updateTabItems() } }