updated didset

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-30 18:04:46 -05:00
parent edd2e48df2
commit ba8e557cd0
29 changed files with 169 additions and 118 deletions

View File

@ -46,7 +46,7 @@ open class TextLink: ButtonBase, Buttonable {
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
open var size: ButtonSize = .large { didSet { setNeedsUpdate() } }
open var size: ButtonSize = .large { didSet { if oldValue != size { setNeedsUpdate() } } }
/// The ButtonSize available to this type of Buttonable.
open override var availableSizes: [ButtonSize] { [.large, .small] }

View File

@ -64,7 +64,7 @@ open class TextLinkCaret: ButtonBase, Buttonable {
public override var availableSizes: [ButtonSize] { [.large] }
/// Determines icon position of Caret.
open var iconPosition: IconPosition = .right { didSet { setNeedsUpdate() } }
open var iconPosition: IconPosition = .right { didSet { if oldValue != iconPosition { setNeedsUpdate() } } }
open override var textAttributes: [any LabelAttributeModel]? {
guard let imageAttribute else { return nil }

View File

@ -35,7 +35,7 @@ open class Checkbox: SelectorBase {
// MARK: - Public Properties
//--------------------------------------------------
/// Whether or not there is animation when the checkbox changes state from non-selected to a selected state.
open var isAnimated: Bool = false { didSet { setNeedsUpdate() } }
open var isAnimated: Bool = false { didSet { if oldValue != isAnimated { setNeedsUpdate() } } }
//--------------------------------------------------
// MARK: - Overrides

View File

@ -31,7 +31,7 @@ open class CheckboxItem: SelectorItemBase<Checkbox> {
// MARK: - Public Properties
//--------------------------------------------------
/// Whether or not there is animation when the checkbox changes state from non-selected to a selected state.
open var isAnimated: Bool = false { didSet { setNeedsUpdate() } }
open var isAnimated: Bool = false { didSet { if oldValue != isAnimated { setNeedsUpdate() } } }
//--------------------------------------------------
// MARK: - Overrides

View File

@ -82,34 +82,34 @@ open class ButtonIcon: Control {
open var icon = Icon().with { $0.isUserInteractionEnabled = false }
/// Determines the type of button based on the contrast.
open var kind: Kind = .ghost { didSet { setNeedsUpdate() } }
open var kind: Kind = .ghost { didSet { if oldValue != kind { setNeedsUpdate() } } }
/// Applies background inside icon button determining the surface type.
open var surfaceType: SurfaceType = .colorFill { didSet { setNeedsUpdate() } }
open var surfaceType: SurfaceType = .colorFill { didSet { if oldValue != surfaceType { setNeedsUpdate() } } }
/// Icon Name used within the Icon.
open var iconName: Icon.Name? { didSet { setNeedsUpdate() } }
open var iconName: Icon.Name? { didSet { if oldValue != iconName { setNeedsUpdate() } } }
/// Icon Name used within the Icon within the Selected State.
open var selectedIconName: Icon.Name? { didSet { setNeedsUpdate() } }
open var selectedIconName: Icon.Name? { didSet { if oldValue != selectedIconName { setNeedsUpdate() } } }
/// Sets the size of button icon and icon.
open var size: Size = .large { didSet { setNeedsUpdate() } }
open var size: Size = .large { didSet { if oldValue != size { setNeedsUpdate() } } }
/// Sets the size of button icon and icon.
open var customSize: Int? { didSet { setNeedsUpdate() } }
open var customSize: Int? { didSet { if oldValue != customSize { setNeedsUpdate() } } }
/// If provided, the button icon will have a box shadow.
open var floating: Bool = false { didSet { setNeedsUpdate() } }
open var floating: Bool = false { didSet { if oldValue != floating { setNeedsUpdate() } } }
/// If true, container shrinks to fit the size of the icon for kind equals .ghost.
open var fitToIcon: Bool = false { didSet { setNeedsUpdate() } }
open var fitToIcon: Bool = false { didSet { if oldValue != fitToIcon { setNeedsUpdate() } } }
/// If set to true, the button icon will not have a border.
open var hideBorder: Bool = true { didSet { setNeedsUpdate() } }
open var hideBorder: Bool = true { didSet { if oldValue != hideBorder { setNeedsUpdate() } } }
/// Used to move the icon inside the button in both x and y axis.
open var iconOffset: CGPoint = .init(x: 0, y: 0) { didSet { setNeedsUpdate() } }
open var iconOffset: CGPoint = .init(x: 0, y: 0) { didSet { if oldValue != iconOffset { setNeedsUpdate() } } }
//--------------------------------------------------
// MARK: - Configuration

View File

@ -60,13 +60,13 @@ open class Icon: View {
}
/// Size of the icon.
open var size: Size = .medium { didSet { setNeedsUpdate() } }
open var size: Size = .medium { didSet { if oldValue != size { setNeedsUpdate() } } }
/// This will be used to render the icon with corresponding name.
open var name: Name? { didSet { setNeedsUpdate() } }
open var name: Name? { didSet { if oldValue != name { setNeedsUpdate() } } }
/// A custom size of the icon.
open var customSize: Int? { didSet { setNeedsUpdate() } }
open var customSize: Int? { didSet { if oldValue != customSize { setNeedsUpdate() } } }
/// The natural size for the receiving view, considering only properties of the view itself.
open override var intrinsicContentSize: CGSize {

View File

@ -24,7 +24,7 @@ extension Icon {
/// let icon = Icon()
/// icon.name = .foo
/// ```
public struct Name: RawRepresentable {
public struct Name: RawRepresentable, Equatable {
public typealias RawValue = String
public var rawValue: String

View File

@ -45,10 +45,10 @@ open class Line: View {
// MARK: - Public Properties
//--------------------------------------------------
/// Style of the line that will be displayed.
open var style: Style = .primary { didSet { setNeedsUpdate() } }
open var style: Style = .primary { didSet { if oldValue != style { setNeedsUpdate() } } }
/// Allows to render the line vertically.
open var orientation: Orientation = .horizontal { didSet { setNeedsUpdate() } }
open var orientation: Orientation = .horizontal { didSet { if oldValue != orientation { setNeedsUpdate() } } }
/// The natural size for the receiving view, considering only properties of the view itself.
open override var intrinsicContentSize: CGSize {

View File

@ -40,13 +40,15 @@ open class Loader: View {
// MARK: - Public Properties
//--------------------------------------------------
/// Loader will be active if 'active' prop is passed.
open var isActive: Bool = true { didSet { setNeedsUpdate() } }
open var isActive: Bool = true { didSet { if oldValue != isActive { setNeedsUpdate() } } }
/// The Int used to determine the height and width of the Loader
open var size: Int = 40 {
didSet {
setNeedsUpdate();
invalidateIntrinsicContentSize()
if oldValue != size {
setNeedsUpdate();
invalidateIntrinsicContentSize()
}
}
}

View File

@ -121,13 +121,13 @@ open class Notification: View {
}
/// Text that will go into the titleLabel.
open var title: String = "" { didSet { setNeedsUpdate()}}
open var title: String = "" { didSet { if oldValue != title { setNeedsUpdate() } } }
/// Text that will go into the subTitleLabel.
open var subTitle: String? { didSet { setNeedsUpdate()}}
open var subTitle: String? { didSet { if oldValue != subTitle { setNeedsUpdate() } } }
/// Button model representing the primaryButton.
open var primaryButtonModel: ButtonModel? { didSet { setNeedsUpdate()}}
open var primaryButtonModel: ButtonModel? { didSet { if oldValue != primaryButtonModel { setNeedsUpdate() } } }
/// Button used for the primary action.
open var primaryButton = Button().with {
@ -136,7 +136,7 @@ open class Notification: View {
}
/// Button model representing the secondaryButton.
open var secondaryButtonModel: ButtonModel? { didSet { setNeedsUpdate()}}
open var secondaryButtonModel: ButtonModel? { didSet { if oldValue != secondaryButtonModel { setNeedsUpdate() } } }
/// Button used for the secondary action.
open var secondaryButton = Button().with {
@ -160,10 +160,10 @@ open class Notification: View {
}
/// If true, will hide the close button.
open var hideCloseButton: Bool = false { didSet { setNeedsUpdate()}}
open var hideCloseButton: Bool = false { didSet { if oldValue != hideCloseButton { setNeedsUpdate() } } }
/// Add this attribute determine your type of Notification.
open var style: Style = .info { didSet { setNeedsUpdate()}}
open var style: Style = .info { didSet { if oldValue != style { setNeedsUpdate() } } }
var _layout: Layout = .vertical

View File

@ -8,7 +8,14 @@
import Foundation
extension Notification {
public struct ButtonModel {
public struct ButtonModel: Equatable, Identifiable {
public static func == (lhs: ButtonModel, rhs: ButtonModel) -> Bool {
lhs.id == rhs.id
}
public var id: String = UUID().uuidString
public var text: String
public var onClick: (Button) -> ()
public init(text: String, onClick: @escaping (Button) -> Void) {

View File

@ -92,10 +92,10 @@ open class RadioBoxItem: Control, Changeable, FormFieldable {
}
/// If provided, the RadioBox text will be rendered.
open var text: String? { didSet { setNeedsUpdate() } }
open var text: String? { didSet { if oldValue != text { setNeedsUpdate() } } }
/// Array of LabelAttributeModel objects used in rendering the text.
open var textAttributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() } }
open var textAttributes: [any LabelAttributeModel]? { didSet { if oldValue != textAttributes { setNeedsUpdate() } } }
/// If provided, the RadioBox textAttributedText will be rendered.
open var textAttributedText: NSAttributedString? {
@ -107,10 +107,10 @@ open class RadioBoxItem: Control, Changeable, FormFieldable {
}
/// If provided, the RadioBox subtext will be rendered.
open var subText: String? { didSet { setNeedsUpdate() } }
open var subText: String? { didSet { if oldValue != subText { setNeedsUpdate() } } }
/// Array of LabelAttributeModel objects used in rendering the subText.
open var subTextAttributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() } }
open var subTextAttributes: [any LabelAttributeModel]? { didSet { if oldValue != subTextAttributes { setNeedsUpdate() } } }
/// If provided, the RadioBox subTextAttributedText will be rendered.
open var subTextAttributedText: NSAttributedString? {
@ -122,10 +122,10 @@ open class RadioBoxItem: Control, Changeable, FormFieldable {
}
/// If provided, the RadioBox subtextRight will be rendered.
open var subTextRight: String? { didSet { setNeedsUpdate() } }
open var subTextRight: String? { didSet { if oldValue != subTextRight { setNeedsUpdate() } } }
/// Array of LabelAttributeModel objects used in rendering the subTextRight.
open var subTextRightAttributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() } }
open var subTextRightAttributes: [any LabelAttributeModel]? { didSet { if oldValue != subTextRightAttributes { setNeedsUpdate() } } }
/// If provided, the RadioBox subTextRightAttributedText will be rendered.
open var subTextRightAttributedText: NSAttributedString? {
@ -137,11 +137,11 @@ open class RadioBoxItem: Control, Changeable, FormFieldable {
}
/// If provided, the radio box will be rendered to show the option with a strikethrough.
open var strikethrough: Bool = false { didSet { setNeedsUpdate() } }
open var strikethrough: Bool = false { didSet { if oldValue != strikethrough { setNeedsUpdate() } } }
open var inputId: String? { didSet { setNeedsUpdate() } }
open var inputId: String? { didSet { if oldValue != inputId { setNeedsUpdate() } } }
open var value: AnyHashable? { didSet { setNeedsUpdate() } }
open var value: AnyHashable? { didSet { if oldValue != value { setNeedsUpdate() } } }
//--------------------------------------------------
// MARK: - Configuration Properties

View File

@ -66,37 +66,37 @@ open class TabsContainer: View {
open var onTabChange: ((Int) -> Void)?
///Determines the layout of the Tabs, defaults to horizontal
open var orientation: Tabs.Orientation = .horizontal { didSet { setNeedsUpdate() } }
open var orientation: Tabs.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: Tabs.IndicatorPosition = .bottom { didSet { setNeedsUpdate() } }
open var indicatorPosition: Tabs.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: Tabs.Overflow = .scroll { didSet { setNeedsUpdate() } }
open var overflow: Tabs.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: Tabs.Size = .medium { didSet { setNeedsUpdate() } }
open var size: Tabs.Size = .medium { didSet { if oldValue != size { setNeedsUpdate() } } }
///Space between the Tabs and Contentl.
open var space: CGFloat = 5.0 { didSet { setNeedsUpdate() } }
open var space: CGFloat = 5.0 { didSet { if oldValue != space { 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() } } }
///rules for width
private var _width: TabsWidth = .percentage(0.25)

View File

@ -129,12 +129,12 @@ open class EntryFieldBase: Control, Changeable {
$0.size = .small
}
open var labelText: String? { didSet { setNeedsUpdate() } }
open var labelText: String? { didSet { if oldValue != labelText { setNeedsUpdate() } } }
open var helperText: String? { didSet { setNeedsUpdate() } }
open var helperText: String? { didSet { if oldValue != helperText { setNeedsUpdate() } } }
/// Whether not to show the error.
open var showError: Bool = false { didSet { setNeedsUpdate() } }
open var showError: Bool = false { didSet { if oldValue != showError { setNeedsUpdate() } } }
/// Override UIControl state to add the .error state if showError is true.
open override var state: UIControl.State {
@ -147,29 +147,29 @@ open class EntryFieldBase: Control, Changeable {
}
}
open var errorText: String? { didSet { setNeedsUpdate() } }
open var errorText: String? { didSet { if oldValue != errorText { setNeedsUpdate() } } }
open var tooltipTitle: String? { didSet { setNeedsUpdate() } }
open var tooltipTitle: String? { didSet { if oldValue != tooltipTitle { setNeedsUpdate() } } }
open var tooltipContent: String? { didSet { setNeedsUpdate() } }
open var tooltipContent: String? { didSet { if oldValue != tooltipContent { setNeedsUpdate() } } }
open var tooltipContentView: UIView? { didSet { setNeedsUpdate() } }
open var tooltipContentView: UIView? { didSet { if oldValue != tooltipContentView { setNeedsUpdate() } } }
open var transparentBackground: Bool = false { didSet { setNeedsUpdate() } }
open var transparentBackground: Bool = false { didSet { if oldValue != transparentBackground { setNeedsUpdate() } } }
open var width: CGFloat? { didSet { setNeedsUpdate() } }
open var width: CGFloat? { didSet { if oldValue != width { setNeedsUpdate() } } }
open var maxLength: Int? { didSet { setNeedsUpdate() } }
open var maxLength: Int? { didSet { if oldValue != maxLength { setNeedsUpdate() } } }
open var inputId: String? { didSet { setNeedsUpdate() } }
open var inputId: String? { didSet { if oldValue != inputId { setNeedsUpdate() } } }
open var value: AnyHashable? { didSet { setNeedsUpdate() } }
open var value: AnyHashable? { didSet { if oldValue != value { setNeedsUpdate() } } }
open var defaultValue: AnyHashable? { didSet { setNeedsUpdate() } }
open var defaultValue: AnyHashable? { didSet { if oldValue != defaultValue { setNeedsUpdate() } } }
open var required: Bool = false { didSet { setNeedsUpdate() } }
open var required: Bool = false { didSet { if oldValue != `required` { setNeedsUpdate() } } }
open var readOnly: Bool = false { didSet { setNeedsUpdate() } }
open var readOnly: Bool = false { didSet { if oldValue != readOnly { setNeedsUpdate() } } }
//--------------------------------------------------
// MARK: - Constraints

View File

@ -76,7 +76,7 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
}.eraseToAnyColorable()
/// Representing the type of input.
open var fieldType: FieldType = .text { didSet { setNeedsUpdate() } }
open var fieldType: FieldType = .text { didSet { if oldValue != fieldType { setNeedsUpdate() } } }
var _showError: Bool = false
/// Whether not to show the error.
@ -113,10 +113,10 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
}
}
/// If given, this will be shown if showSuccess if true.
open var successText: String? { didSet { setNeedsUpdate() } }
open var successText: String? { didSet { if oldValue != successText { setNeedsUpdate() } } }
/// Determines the placement of the helper text.
open var helperTextPlacement: HelperTextPlacement = .bottom { didSet { setNeedsUpdate() } }
open var helperTextPlacement: HelperTextPlacement = .bottom { didSet { if oldValue != helperTextPlacement { setNeedsUpdate() } } }
//--------------------------------------------------
// MARK: - Overrides

View File

@ -90,7 +90,7 @@ open class TileContainer: Control {
// MARK: - Public Properties
//--------------------------------------------------
/// This takes an image source url and applies it as a background image.
open var backgroundImage: UIImage? { didSet { setNeedsUpdate() } }
open var backgroundImage: UIImage? { didSet { if oldValue != backgroundImage { setNeedsUpdate() } } }
/// This is the container in which views will be pinned.
open var containerView = View().with {
@ -103,16 +103,16 @@ open class TileContainer: Control {
}
/// This controls the aspect ratio for the component.
open var aspectRatio: AspectRatio = .ratio1x1 { didSet { setNeedsUpdate() } }
open var aspectRatio: AspectRatio = .ratio1x1 { didSet { if oldValue != aspectRatio { setNeedsUpdate() } } }
/// Sets the background color for the component.
open var color: BackgroundColor = .white { didSet { setNeedsUpdate() } }
open var color: BackgroundColor = .white { didSet { if oldValue != color { setNeedsUpdate() } } }
/// Sets the inside padding for the component
open var padding: Padding = .padding4X { didSet { setNeedsUpdate() } }
open var padding: Padding = .padding4X { didSet { if oldValue != padding { setNeedsUpdate() } } }
/// Applies a background color if backgroundImage prop fails or has trouble loading.
open var imageFallbackColor: Surface = .light { didSet { setNeedsUpdate() } }
open var imageFallbackColor: Surface = .light { didSet { if oldValue != imageFallbackColor { setNeedsUpdate() } } }
private var _width: CGFloat?
/// Sets the width for the component. Accepts a pixel value.
@ -143,10 +143,10 @@ open class TileContainer: Control {
}
/// If true, a border is rendered around the container.
open var showBorder: Bool = false { didSet { setNeedsUpdate() } }
open var showBorder: Bool = false { didSet { if oldValue != showBorder { setNeedsUpdate() } } }
/// Determines if there is a drop shadow or not.
open var showDropShadows: Bool = false { didSet { setNeedsUpdate() } }
open var showDropShadows: Bool = false { didSet { if oldValue != showDropShadows { setNeedsUpdate() } } }
//--------------------------------------------------
// MARK: - Constraints

View File

@ -165,16 +165,16 @@ open class Tilelet: TileContainer {
}
/// Determines where the text aligns vertically.
open var textPostion: TextPosition = .top { didSet { setNeedsUpdate() } }
open var textPostion: TextPosition = .top { didSet { if oldValue != textPostion { setNeedsUpdate() } } }
/// If set, this is used to render the badge.
open var badgeModel: BadgeModel? { didSet { setNeedsUpdate() } }
open var badgeModel: BadgeModel? { didSet { if oldValue != badgeModel { setNeedsUpdate() } } }
/// If set, this is used to render the titleLabel of the TitleLockup.
open var titleModel: TitleModel? { didSet { setNeedsUpdate() } }
open var titleModel: TitleModel? { didSet { if oldValue != titleModel { setNeedsUpdate() } } }
/// If set, this is used to render the subTitleLabel of the TitleLockup.
open var subTitleModel: SubTitleModel? { didSet { setNeedsUpdate() } }
open var subTitleModel: SubTitleModel? { didSet { if oldValue != subTitleModel { setNeedsUpdate() } } }
//only 1 Icon can be active
private var _descriptiveIconModel: DescriptiveIcon?

View File

@ -10,7 +10,14 @@ import Foundation
extension Tilelet {
/// Model that represents the options available for the badge.
public struct BadgeModel {
public struct BadgeModel: Equatable, Identifiable {
public static func == (lhs: BadgeModel, rhs: BadgeModel) -> Bool {
lhs.id == rhs.id
}
public var id: String = UUID().uuidString
/// Text that will be used for the badge.
public var text: String = ""

View File

@ -9,7 +9,14 @@ import Foundation
extension Tilelet {
/// Model that represents the options available for the sub title label.
public struct SubTitleModel {
public struct SubTitleModel: Equatable, Identifiable {
public static func == (lhs: SubTitleModel, rhs: SubTitleModel) -> Bool {
lhs.id == rhs.id
}
public var id: String = UUID().uuidString
//--------------------------------------------------
// MARK: - Enums
//--------------------------------------------------

View File

@ -9,7 +9,14 @@ import Foundation
extension Tilelet {
/// Model that represents the options available for the title label.
public struct TitleModel {
public struct TitleModel: Equatable, Identifiable {
public static func == (lhs: TitleModel, rhs: TitleModel) -> Bool {
lhs.id == rhs.id
}
public var id: String = UUID().uuidString
//--------------------------------------------------
// MARK: - Enums
//--------------------------------------------------

View File

@ -68,7 +68,7 @@ open class TitleLockup: View {
// MARK: - Public Properties
//--------------------------------------------------
/// Aligns TitleLockup's subcomponent's text
open var textAlignment: TextAlignment = .left { didSet { setNeedsUpdate() } }
open var textAlignment: TextAlignment = .left { didSet { if oldValue != textAlignment { setNeedsUpdate() } } }
//first row
/// Label used to render the eyebrow model.
@ -77,7 +77,7 @@ open class TitleLockup: View {
}
/// Model used in rendering the eyebrow label.
open var eyebrowModel: EyebrowModel? { didSet { setNeedsUpdate() } }
open var eyebrowModel: EyebrowModel? { didSet { if oldValue != eyebrowModel { setNeedsUpdate() } } }
//second row
/// Label used to render the title model.
@ -86,7 +86,7 @@ open class TitleLockup: View {
}
/// Model used in rendering the title label.
open var titleModel: TitleModel? { didSet { setNeedsUpdate() } }
open var titleModel: TitleModel? { didSet { if oldValue != titleModel { setNeedsUpdate() } } }
//third row
/// Label used to render the subtitle model.
@ -95,7 +95,7 @@ open class TitleLockup: View {
}
/// Model used in rendering the subtitle label.
open var subTitleModel: SubTitleModel? { didSet { setNeedsUpdate() } }
open var subTitleModel: SubTitleModel? { didSet { if oldValue != subTitleModel { setNeedsUpdate() } } }
//--------------------------------------------------
// MARK: - Configuration Properties

View File

@ -9,7 +9,14 @@ import Foundation
extension TitleLockup {
/// Model that represents the options available for the eyebrow label.
public struct EyebrowModel {
public struct EyebrowModel: Equatable, Identifiable {
public static func == (lhs: EyebrowModel, rhs: EyebrowModel) -> Bool {
lhs.id == rhs.id
}
public var id: String = UUID().uuidString
/// Text that will be used for the eyebrow label.
public var text: String

View File

@ -9,7 +9,14 @@ import Foundation
extension TitleLockup {
/// Model that represents the options available for the sub title label.
public struct SubTitleModel {
public struct SubTitleModel: Equatable, Identifiable {
public static func == (lhs: SubTitleModel, rhs: SubTitleModel) -> Bool {
lhs.id == rhs.id
}
public var id: String = UUID().uuidString
/// Text that will be used for the subTitle label.
public var text: String

View File

@ -9,7 +9,14 @@ import Foundation
extension TitleLockup {
/// Model that represents the options available for the sub title label.
public struct TitleModel {
public struct TitleModel: Equatable, Identifiable {
public static func == (lhs: TitleModel, rhs: TitleModel) -> Bool {
lhs.id == rhs.id
}
public var id: String = UUID().uuidString
/// Text that will be used for the title label.
public var text: String

View File

@ -127,32 +127,32 @@ open class Toggle: Control, Changeable, FormFieldable {
}
/// If set to true, the toggle view will include animation between state changes.
open var isAnimated: Bool = true { didSet { setNeedsUpdate() } }
open var isAnimated: Bool = true { didSet { if oldValue != isAnimated { setNeedsUpdate() } } }
/// If set to true, displays text either to the right or left of the toggle.
open var showText: Bool = false { didSet { setNeedsUpdate() } }
open var showText: Bool = false { didSet { if oldValue != showText { setNeedsUpdate() } } }
/// Text that will be shown in the status text when isOn is true
open var onText: String = "On" { didSet { setNeedsUpdate() } }
open var onText: String = "On" { didSet { if oldValue != onText { setNeedsUpdate() } } }
/// Text that will be shown in the status text when isOn is false
open var offText: String = "Off" { didSet { setNeedsUpdate() } }
open var offText: String = "Off" { didSet { if oldValue != offText { setNeedsUpdate() } } }
/// Returns the correct text status based on the isOn state and correlates with onText or offText.
open var statusText: String { isOn ? onText : offText }
/// Changes the font size of the status text.
open var textSize: TextSize = .small { didSet { setNeedsUpdate() } }
open var textSize: TextSize = .small { didSet { if oldValue != textSize { setNeedsUpdate() } } }
/// Changes the font weight of the status text.
open var textWeight: TextWeight = .regular { didSet { setNeedsUpdate() } }
open var textWeight: TextWeight = .regular { didSet { if oldValue != textWeight { setNeedsUpdate() } } }
/// Positions status text to either the right or left of toggle.
open var textPosition: TextPosition = .left { didSet { setNeedsUpdate() } }
open var textPosition: TextPosition = .left { didSet { if oldValue != textPosition { setNeedsUpdate() } } }
open var inputId: String? { didSet { setNeedsUpdate() } }
open var inputId: String? { didSet { if oldValue != inputId { setNeedsUpdate() } } }
open var value: AnyHashable? { didSet { setNeedsUpdate() } }
open var value: AnyHashable? { didSet { if oldValue != value { setNeedsUpdate() } } }
/// The natural size for the receiving view, considering only properties of the view itself.
open override var intrinsicContentSize: CGSize {

View File

@ -64,11 +64,11 @@ open class ToggleView: Control, Changeable, FormFieldable {
}
}
/// If set to true, the toggle view will include animation between state changes.
open var isAnimated: Bool = true { didSet { setNeedsUpdate() } }
open var isAnimated: Bool = true { didSet { if oldValue != isAnimated { setNeedsUpdate() } } }
open var inputId: String? { didSet { setNeedsUpdate() } }
open var inputId: String? { didSet { if oldValue != inputId { setNeedsUpdate() } } }
open var value: AnyHashable? { didSet { setNeedsUpdate() } }
open var value: AnyHashable? { didSet { if oldValue != value { setNeedsUpdate() } } }
/// The natural size for the receiving view, considering only properties of the view itself.
open override var intrinsicContentSize: CGSize { toggleSize }

View File

@ -66,22 +66,22 @@ open class Tooltip: Control, TooltipLaunchable {
}
/// Will render the text for Close button for tooltip dialog when on mobile devices
open var closeButtonText: String = "Close" { didSet { setNeedsUpdate() } }
open var closeButtonText: String = "Close" { didSet { if oldValue != closeButtonText { setNeedsUpdate() } } }
/// Will render icon in brand colors.
open var fillColor: FillColor = .primary { didSet { setNeedsUpdate() } }
open var fillColor: FillColor = .primary { didSet { if oldValue != fillColor { setNeedsUpdate() } } }
/// Size of the icon
open var size: Size = .medium { didSet { setNeedsUpdate() } }
open var size: Size = .medium { didSet { if oldValue != size { setNeedsUpdate() } } }
/// Text rendered for the title of the tooltip
open var title: String? { didSet { setNeedsUpdate() } }
open var title: String? { didSet { if oldValue != title { setNeedsUpdate() } } }
/// Text rendered for the content of the tooltip
open var content: String? { didSet { setNeedsUpdate() } }
open var content: String? { didSet { if oldValue != content { setNeedsUpdate() } } }
/// UIView rendered for the content area of the tooltip
open var contentView: UIView? { didSet { setNeedsUpdate() } }
open var contentView: UIView? { didSet { if oldValue != contentView { setNeedsUpdate() } } }
//--------------------------------------------------
// MARK: - Configuration

View File

@ -54,13 +54,13 @@ open class TooltipDialog: View, UIScrollViewDelegate {
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
open var titleText: String? { didSet { setNeedsUpdate() } }
open var titleText: String? { didSet { if oldValue != titleText { setNeedsUpdate() } } }
open var titleLabel = Label().with { label in
label.isAccessibilityElement = true
label.textStyle = .boldTitleMedium
}
open var contentText: String? { didSet { setNeedsUpdate() } }
open var contentText: String? { didSet { if oldValue != contentText { setNeedsUpdate() } } }
open var contentLabel = Label().with { label in
label.isAccessibilityElement = true
label.textStyle = .bodyLarge
@ -68,7 +68,7 @@ open class TooltipDialog: View, UIScrollViewDelegate {
open var contentView: UIView? = nil
open var closeButtonText: String = "Close" { didSet { setNeedsUpdate() } }
open var closeButtonText: String = "Close" { didSet { if oldValue != closeButtonText { setNeedsUpdate() } } }
open lazy var closeButton: UIButton = {
let button = UIButton(type: .system)

View File

@ -41,16 +41,16 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
open var label = Label()
/// Text used to render the label.
open var labelText: String? { didSet { setNeedsUpdate() } }
open var labelText: String? { didSet { if oldValue != labelText { setNeedsUpdate() } } }
/// Attributes used to render the label.
open var labelAttributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() } }
open var labelAttributes: [any LabelAttributeModel]? { didSet { if oldValue != labelAttributes { setNeedsUpdate() } } }
/// Text style used to render the label.
open var labelTextStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() } }
open var labelTextStyle: TextStyle = .defaultStyle { didSet { if oldValue != labelTextStyle { setNeedsUpdate() } } }
/// Text position used to render the label.
open var labelTextAlignment: TextAlignment = .left { didSet { setNeedsUpdate() } }
open var labelTextAlignment: TextAlignment = .left { didSet { if oldValue != labelTextAlignment { setNeedsUpdate() } } }
/// Color configuration set for the label.
public lazy var textColorConfiguration: AnyColorable = {
@ -58,16 +58,16 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
}() { didSet { setNeedsUpdate() } }
/// Will render the text for Close button for tooltip dialog when on mobile devices
open var tooltipCloseButtonText: String = "Close" { didSet { setNeedsUpdate() } }
open var tooltipCloseButtonText: String = "Close" { didSet { if oldValue != tooltipCloseButtonText { setNeedsUpdate() } } }
/// Text rendered for the title of the tooltip
open var tooltipTitle: String? { didSet { setNeedsUpdate() } }
open var tooltipTitle: String? { didSet { if oldValue != tooltipTitle { setNeedsUpdate() } } }
/// Text rendered for the content of the tooltip
open var tooltipContent: String? { didSet { setNeedsUpdate() } }
open var tooltipContent: String? { didSet { if oldValue != tooltipContent { setNeedsUpdate() } } }
/// UIView rendered for the content area of the tooltip
open var tooltipContentView: UIView? { didSet { setNeedsUpdate() } }
open var tooltipContentView: UIView? { didSet { if oldValue != tooltipContentView { setNeedsUpdate() } } }
//--------------------------------------------------
// MARK: - Overrides