added documentaion comments.
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
304416afdb
commit
da1434fdfd
@ -16,7 +16,6 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Combine Properties
|
// MARK: - Combine Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Set of Subscribers for any Publishers for this Control.
|
|
||||||
open var subscribers = Set<AnyCancellable>()
|
open var subscribers = Set<AnyCancellable>()
|
||||||
|
|
||||||
open var onClickSubscriber: AnyCancellable? {
|
open var onClickSubscriber: AnyCancellable? {
|
||||||
@ -32,12 +31,10 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private var initialSetupPerformed = false
|
private var initialSetupPerformed = false
|
||||||
|
|
||||||
/// Key of whether or not updateView() is called in setNeedsUpdate()
|
|
||||||
open var shouldUpdateView: Bool = true
|
open var shouldUpdateView: Bool = true
|
||||||
|
|
||||||
open var userInfo = [String: Primitive]()
|
open var userInfo = [String: Primitive]()
|
||||||
|
|
||||||
/// Current Surface and this is used to pass down to child objects that implement Surfacable
|
|
||||||
open var surface: Surface = .light { didSet { setNeedsUpdate() } }
|
open var surface: Surface = .light { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
/// Whether the Control is selected or not.
|
/// Whether the Control is selected or not.
|
||||||
@ -50,7 +47,7 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable {
|
|||||||
|
|
||||||
var isHighlightAnimating = false
|
var isHighlightAnimating = false
|
||||||
|
|
||||||
/// Whether the Control is highlighted or not..
|
/// Whether the Control is highlighted or not.
|
||||||
open override var isHighlighted: Bool {
|
open override var isHighlighted: Bool {
|
||||||
didSet {
|
didSet {
|
||||||
if canHighlight && isHighlightAnimating == false && touchUpInsideCount > 0 {
|
if canHighlight && isHighlightAnimating == false && touchUpInsideCount > 0 {
|
||||||
@ -113,7 +110,6 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable {
|
|||||||
insetsLayoutMarginsFromSafeArea = false
|
insetsLayoutMarginsFromSafeArea = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
|
||||||
open func updateView() { }
|
open func updateView() { }
|
||||||
|
|
||||||
open func updateAccessibility() {
|
open func updateAccessibility() {
|
||||||
@ -131,7 +127,6 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
|
||||||
open func reset() {
|
open func reset() {
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
surface = .light
|
surface = .light
|
||||||
|
|||||||
@ -11,10 +11,19 @@ import VDSColorTokens
|
|||||||
import VDSFormControlsTokens
|
import VDSFormControlsTokens
|
||||||
|
|
||||||
public protocol SelectorControlable: Control, Changeable {
|
public protocol SelectorControlable: Control, Changeable {
|
||||||
|
/// Whether not to show the error.
|
||||||
var showError: Bool { get set }
|
var showError: Bool { get set }
|
||||||
|
|
||||||
|
/// Size of the SelectorView.
|
||||||
var size: CGSize { get set }
|
var size: CGSize { get set }
|
||||||
|
|
||||||
|
/// Configuration for the Background Color based on Control State.
|
||||||
var backgroundColorConfiguration: ControlColorConfiguration { get set }
|
var backgroundColorConfiguration: ControlColorConfiguration { get set }
|
||||||
|
|
||||||
|
/// Configuration for the Border Color based on Control State.
|
||||||
var borderColorConfiguration: ControlColorConfiguration { get set }
|
var borderColorConfiguration: ControlColorConfiguration { get set }
|
||||||
|
|
||||||
|
/// Configuration for the Selector Color based on Control State.
|
||||||
var selectorColorConfiguration: ControlColorConfiguration { get set }
|
var selectorColorConfiguration: ControlColorConfiguration { get set }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,6 +50,7 @@ open class SelectorBase: Control, SelectorControlable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Override UIControl state to add the .error state if showError is true.
|
||||||
open override var state: UIControl.State {
|
open override var state: UIControl.State {
|
||||||
get {
|
get {
|
||||||
var state = super.state
|
var state = super.state
|
||||||
@ -68,6 +78,7 @@ open class SelectorBase: Control, SelectorControlable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
/// The natural size for the receiving view, considering only properties of the view itself.
|
||||||
open override var intrinsicContentSize: CGSize { size }
|
open override var intrinsicContentSize: CGSize { size }
|
||||||
|
|
||||||
open override func initialSetup() {
|
open override func initialSetup() {
|
||||||
@ -77,6 +88,7 @@ open class SelectorBase: Control, SelectorControlable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
|
||||||
@ -84,13 +96,14 @@ open class SelectorBase: Control, SelectorControlable {
|
|||||||
accessibilityTraits = .button
|
accessibilityTraits = .button
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
setNeedsLayout()
|
setNeedsLayout()
|
||||||
layoutIfNeeded()
|
layoutIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Used to update any Accessibility properties.ß
|
||||||
open override func updateAccessibility() {
|
open override func updateAccessibility() {
|
||||||
super.updateAccessibility()
|
super.updateAccessibility()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,6 @@ open class SelectorGroupHandlerBase<HandlerType: Control>: Control, Changeable {
|
|||||||
/// Array of the HandlerType registered.
|
/// Array of the HandlerType registered.
|
||||||
open var selectorViews: [HandlerType] = []
|
open var selectorViews: [HandlerType] = []
|
||||||
|
|
||||||
/// The primary subscriber for onChange or the UIControl valueChanged event.
|
|
||||||
open var onChangeSubscriber: AnyCancellable? {
|
open var onChangeSubscriber: AnyCancellable? {
|
||||||
willSet {
|
willSet {
|
||||||
if let onChangeSubscriber {
|
if let onChangeSubscriber {
|
||||||
@ -28,14 +27,13 @@ open class SelectorGroupHandlerBase<HandlerType: Control>: Control, Changeable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Whether this object is enabled or not
|
|
||||||
override open var isEnabled: Bool {
|
override open var isEnabled: Bool {
|
||||||
didSet {
|
didSet {
|
||||||
selectorViews.forEach { $0.isEnabled = isEnabled }
|
selectorViews.forEach { $0.isEnabled = isEnabled }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Current Surface and this is used to pass down to child objects that implement Surfacable.
|
///The background tint that the component will be placed on. This will automatically adjust other elements as needed and takes “light” or “dark”
|
||||||
override open var surface: Surface {
|
override open var surface: Surface {
|
||||||
didSet {
|
didSet {
|
||||||
selectorViews.forEach { handler in
|
selectorViews.forEach { handler in
|
||||||
@ -61,12 +59,13 @@ open class SelectorGroupHandlerBase<HandlerType: Control>: Control, Changeable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings as well as child views.
|
/// Resets to default settings.
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
selectorViews.forEach{ $0.reset() }
|
selectorViews.forEach{ $0.reset() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Used to update any Accessibility properties.
|
||||||
open override func updateAccessibility() {
|
open override func updateAccessibility() {
|
||||||
super.updateAccessibility()
|
super.updateAccessibility()
|
||||||
setAccessibilityLabel(for: selectorViews)
|
setAccessibilityLabel(for: selectorViews)
|
||||||
|
|||||||
@ -62,7 +62,6 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Subscriber that is set for the .valueChanged event.
|
|
||||||
open var onChangeSubscriber: AnyCancellable? {
|
open var onChangeSubscriber: AnyCancellable? {
|
||||||
willSet {
|
willSet {
|
||||||
if let onChangeSubscriber {
|
if let onChangeSubscriber {
|
||||||
@ -95,7 +94,6 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
|
|||||||
/// Generic Object used to allow the user to 'Select'.
|
/// Generic Object used to allow the user to 'Select'.
|
||||||
open var selectorView = Selector()
|
open var selectorView = Selector()
|
||||||
|
|
||||||
/// Whether or not ths Item is selected.
|
|
||||||
open override var isSelected: Bool { didSet { setNeedsUpdate() }}
|
open override var isSelected: Bool { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
/// Text shown in the label.
|
/// Text shown in the label.
|
||||||
@ -167,6 +165,7 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
|
||||||
@ -184,7 +183,7 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
|
|||||||
mainStackView.pinToSuperView()
|
mainStackView.pinToSuperView()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
updateLabels()
|
updateLabels()
|
||||||
@ -195,6 +194,7 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
|
|||||||
selectorView.surface = surface
|
selectorView.surface = surface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Used to update any Accessibility properties.
|
||||||
open override func updateAccessibility() {
|
open override func updateAccessibility() {
|
||||||
super.updateAccessibility()
|
super.updateAccessibility()
|
||||||
setAccessibilityLabel(for: [label, childLabel, errorLabel])
|
setAccessibilityLabel(for: [label, childLabel, errorLabel])
|
||||||
|
|||||||
@ -36,7 +36,7 @@ public final class SelfSizingCollectionView: UICollectionView {
|
|||||||
// MARK: - UIView
|
// MARK: - UIView
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
/// The natural size for the receiving view, considering only properties of the view itself.
|
||||||
public override var intrinsicContentSize: CGSize {
|
public override var intrinsicContentSize: CGSize {
|
||||||
let contentSize = self.contentSize
|
let contentSize = self.contentSize
|
||||||
//print(#function, contentSize)
|
//print(#function, contentSize)
|
||||||
|
|||||||
@ -16,7 +16,6 @@ open class View: UIView, ViewProtocol, UserInfoable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Combine Properties
|
// MARK: - Combine Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Set of Subscribers for any Publishers for this Control.
|
|
||||||
open var subscribers = Set<AnyCancellable>()
|
open var subscribers = Set<AnyCancellable>()
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -24,16 +23,13 @@ open class View: UIView, ViewProtocol, UserInfoable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private var initialSetupPerformed = false
|
private var initialSetupPerformed = false
|
||||||
|
|
||||||
/// Key of whether or not updateView() is called in setNeedsUpdate()
|
|
||||||
open var shouldUpdateView: Bool = true
|
open var shouldUpdateView: Bool = true
|
||||||
|
|
||||||
/// Dictionary for keeping information for this Control use only Primitives.
|
/// Dictionary for keeping information for this Control use only Primitives.
|
||||||
open var userInfo = [String: Primitive]()
|
open var userInfo = [String: Primitive]()
|
||||||
|
|
||||||
/// Current Surface and this is used to pass down to child objects that implement Surfacable
|
|
||||||
open var surface: Surface = .light { didSet { setNeedsUpdate() } }
|
open var surface: Surface = .light { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
/// Whether the View is enabled or not.
|
|
||||||
open var isEnabled: Bool = true { didSet { setNeedsUpdate() } }
|
open var isEnabled: Bool = true { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -67,18 +63,14 @@ open class View: UIView, ViewProtocol, UserInfoable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Will be called only once and should be overridden in subclasses to setup UI or defaults.
|
|
||||||
open func setup() {
|
open func setup() {
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
translatesAutoresizingMaskIntoConstraints = false
|
translatesAutoresizingMaskIntoConstraints = false
|
||||||
insetsLayoutMarginsFromSafeArea = false
|
insetsLayoutMarginsFromSafeArea = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties..
|
open func updateView() { }
|
||||||
open func updateView() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Used to update any Accessibility properties.
|
|
||||||
open func updateAccessibility() {
|
open func updateAccessibility() {
|
||||||
if isEnabled {
|
if isEnabled {
|
||||||
accessibilityTraits.remove(.notEnabled)
|
accessibilityTraits.remove(.notEnabled)
|
||||||
@ -87,7 +79,6 @@ open class View: UIView, ViewProtocol, UserInfoable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
|
||||||
open func reset() {
|
open func reset() {
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
surface = .light
|
surface = .light
|
||||||
|
|||||||
@ -144,7 +144,7 @@ open class Badge: View {
|
|||||||
setNeedsUpdate()
|
setNeedsUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -306,7 +306,7 @@ open class BadgeIndicator: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,7 @@ open class Button: ButtonBase, Useable {
|
|||||||
textColorConfiguration.getColor(self)
|
textColorConfiguration.getColor(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// TextStyle used on the titleLabel.
|
||||||
open override var textStyle: TextStyle {
|
open override var textStyle: TextStyle {
|
||||||
size == .large ? TextStyle.boldBodyLarge : TextStyle.boldBodySmall
|
size == .large ? TextStyle.boldBodyLarge : TextStyle.boldBodySmall
|
||||||
}
|
}
|
||||||
@ -121,7 +122,7 @@ open class Button: ButtonBase, Useable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Functions
|
// MARK: - Public Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
@ -144,6 +145,7 @@ open class Button: ButtonBase, Useable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
/// The natural size for the receiving view, considering only properties of the view itself.
|
||||||
open override var intrinsicContentSize: CGSize {
|
open override var intrinsicContentSize: CGSize {
|
||||||
guard let width, width > 0 else {
|
guard let width, width > 0 else {
|
||||||
var superSize = super.intrinsicContentSize
|
var superSize = super.intrinsicContentSize
|
||||||
@ -154,7 +156,7 @@ open class Button: ButtonBase, Useable {
|
|||||||
return CGSize(width: width > size.minimumWidth ? width : size.minimumWidth, height: size.height)
|
return CGSize(width: width > size.minimumWidth ? width : size.minimumWidth, height: size.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -12,8 +12,14 @@ import VDSFormControlsTokens
|
|||||||
import Combine
|
import Combine
|
||||||
|
|
||||||
public protocol Buttonable: UIControl, Surfaceable, Enabling {
|
public protocol Buttonable: UIControl, Surfaceable, Enabling {
|
||||||
|
|
||||||
|
/// The ButtonSize available to this type of Buttonable.
|
||||||
var availableSizes: [ButtonSize] { get }
|
var availableSizes: [ButtonSize] { get }
|
||||||
|
|
||||||
|
/// The Text that will show up in the TitleLabel for this Buttonable.
|
||||||
var text: String? { get set }
|
var text: String? { get set }
|
||||||
|
|
||||||
|
/// The natural size for the receiving view, considering only properties of the view itself.
|
||||||
var intrinsicContentSize: CGSize { get }
|
var intrinsicContentSize: CGSize { get }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,16 +57,23 @@ open class ButtonBase: UIButton, Buttonable, ViewProtocol, UserInfoable, Clickab
|
|||||||
open var shouldUpdateView: Bool = true
|
open var shouldUpdateView: Bool = true
|
||||||
|
|
||||||
open var availableSizes: [ButtonSize] { [] }
|
open var availableSizes: [ButtonSize] { [] }
|
||||||
|
|
||||||
|
open var surface: Surface = .light { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
open var text: String? { didSet { setNeedsUpdate() } }
|
open var text: String? { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the text.
|
||||||
open var textAttributes: [any LabelAttributeModel]? { nil }
|
open var textAttributes: [any LabelAttributeModel]? { nil }
|
||||||
|
|
||||||
|
/// TextStyle used on the titleLabel.
|
||||||
|
open var textStyle: TextStyle { .defaultStyle }
|
||||||
|
|
||||||
|
/// UIColor used on the titleLabel text.
|
||||||
|
open var textColor: UIColor { .black }
|
||||||
|
|
||||||
|
/// Will determine if a scaled font should be used for the titleLabel font.
|
||||||
open var useScaledFont: Bool = false { didSet { setNeedsUpdate() }}
|
open var useScaledFont: Bool = false { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
/// Current Surface and this is used to pass down to child objects that implement Surfacable
|
|
||||||
open var surface: Surface = .light { didSet { setNeedsUpdate() }}
|
|
||||||
|
|
||||||
open var userInfo = [String: Primitive]()
|
open var userInfo = [String: Primitive]()
|
||||||
|
|
||||||
open var touchUpInsideCount: Int = 0
|
open var touchUpInsideCount: Int = 0
|
||||||
@ -87,10 +100,6 @@ open class ButtonBase: UIButton, Buttonable, ViewProtocol, UserInfoable, Clickab
|
|||||||
/// Whether the Control is enabled or not.
|
/// Whether the Control is enabled or not.
|
||||||
open override var isEnabled: Bool { didSet { setNeedsUpdate() } }
|
open override var isEnabled: Bool { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
open var textStyle: TextStyle { .defaultStyle }
|
|
||||||
|
|
||||||
open var textColor: UIColor { .black }
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -110,7 +119,7 @@ open class ButtonBase: UIButton, Buttonable, ViewProtocol, UserInfoable, Clickab
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Functions
|
// MARK: - Public Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open func initialSetup() {
|
open func initialSetup() {
|
||||||
if !initialSetupPerformed {
|
if !initialSetupPerformed {
|
||||||
@ -151,7 +160,7 @@ open class ButtonBase: UIButton, Buttonable, ViewProtocol, UserInfoable, Clickab
|
|||||||
return CGSize(width: adjustedWidth, height: adjustedHeight)
|
return CGSize(width: adjustedWidth, height: adjustedHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open func updateView() {
|
open func updateView() {
|
||||||
updateLabel()
|
updateLabel()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -125,7 +125,7 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
|
|||||||
super.init(coder: coder)
|
super.init(coder: coder)
|
||||||
}
|
}
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Functions
|
// MARK: - Public Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
@ -137,7 +137,7 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
positionLayout.position = buttonPosition
|
positionLayout.position = buttonPosition
|
||||||
|
|||||||
@ -34,6 +34,7 @@ open class TextLink: ButtonBase {
|
|||||||
size == .large ? TextStyle.bodyLarge : TextStyle.bodySmall
|
size == .large ? TextStyle.bodyLarge : TextStyle.bodySmall
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// UIColor used on the titleLabel text.
|
||||||
open override var textColor: UIColor {
|
open override var textColor: UIColor {
|
||||||
textColorConfiguration.getColor(self)
|
textColorConfiguration.getColor(self)
|
||||||
}
|
}
|
||||||
@ -69,7 +70,7 @@ open class TextLink: ButtonBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Functions
|
// MARK: - Public Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
@ -103,11 +104,12 @@ open class TextLink: ButtonBase {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
/// The natural size for the receiving view, considering only properties of the view itself.
|
||||||
open override var intrinsicContentSize: CGSize {
|
open override var intrinsicContentSize: CGSize {
|
||||||
return titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize
|
return titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
//need to set the properties so the super class
|
//need to set the properties so the super class
|
||||||
//can render out the label correctly
|
//can render out the label correctly
|
||||||
|
|||||||
@ -46,6 +46,7 @@ open class TextLinkCaret: ButtonBase {
|
|||||||
44
|
44
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// UIColor used on the titleLabel text.
|
||||||
open override var textColor: UIColor {
|
open override var textColor: UIColor {
|
||||||
textColorConfiguration.getColor(self)
|
textColorConfiguration.getColor(self)
|
||||||
}
|
}
|
||||||
@ -72,7 +73,7 @@ open class TextLinkCaret: ButtonBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Functions
|
// MARK: - Public Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
@ -89,12 +90,13 @@ open class TextLinkCaret: ButtonBase {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
/// The natural size for the receiving view, considering only properties of the view itself.
|
||||||
override open var intrinsicContentSize: CGSize {
|
override open var intrinsicContentSize: CGSize {
|
||||||
//get the labels size, if not the button
|
//get the labels size, if not the button
|
||||||
return titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize
|
return titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
imageAttribute = CaretLabelAttribute(tintColor: textColor, position: iconPosition)
|
imageAttribute = CaretLabelAttribute(tintColor: textColor, position: iconPosition)
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|||||||
@ -120,8 +120,10 @@ extension CheckboxGroup {
|
|||||||
public var value: AnyHashable?
|
public var value: AnyHashable?
|
||||||
public var accessibileText: String?
|
public var accessibileText: String?
|
||||||
public var labelText: String?
|
public var labelText: String?
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the labeText.
|
||||||
public var labelTextAttributes: [any LabelAttributeModel]?
|
public var labelTextAttributes: [any LabelAttributeModel]?
|
||||||
public var childText: String?
|
public var childText: String?
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the childText.
|
||||||
public var childTextAttributes: [any LabelAttributeModel]?
|
public var childTextAttributes: [any LabelAttributeModel]?
|
||||||
public var selected: Bool
|
public var selected: Bool
|
||||||
public var showError: Bool
|
public var showError: Bool
|
||||||
|
|||||||
@ -44,7 +44,7 @@ open class CheckboxItem: SelectorItemBase<Checkbox> {
|
|||||||
sendActions(for: .valueChanged)
|
sendActions(for: .valueChanged)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
selectorView.isAnimated = isAnimated
|
selectorView.isAnimated = isAnimated
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|||||||
@ -263,7 +263,7 @@ open class ButtonIcon: Control {
|
|||||||
setNeedsUpdate()
|
setNeedsUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -71,11 +71,12 @@ open class Icon: View {
|
|||||||
imageView.image = nil
|
imageView.image = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The natural size for the receiving view, considering only properties of the view itself.
|
||||||
open override var intrinsicContentSize: CGSize {
|
open override var intrinsicContentSize: CGSize {
|
||||||
dimensions
|
dimensions
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
//get the color for the image
|
//get the color for the image
|
||||||
|
|||||||
@ -52,7 +52,7 @@ public struct ImageLabelAttribute: AttachmentLabelAttributeModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Functions
|
// MARK: - Private Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private func imageAttachment(image: UIImage) -> NSTextAttachment {
|
private func imageAttachment(image: UIImage) -> NSTextAttachment {
|
||||||
let attachment = NSTextAttachment()
|
let attachment = NSTextAttachment()
|
||||||
@ -70,7 +70,7 @@ public struct ImageLabelAttribute: AttachmentLabelAttributeModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Functions
|
// MARK: - Public Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public func getAttachment() throws -> NSTextAttachment {
|
public func getAttachment() throws -> NSTextAttachment {
|
||||||
|
|
||||||
|
|||||||
@ -9,12 +9,19 @@ import Foundation
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public protocol LabelAttributeModel: AnyEquatable, Withable, Equatable, Identifiable where ID == UUID {
|
public protocol LabelAttributeModel: AnyEquatable, Withable, Equatable, Identifiable where ID == UUID {
|
||||||
|
/// Position of the starting point for this LabelAttribute.
|
||||||
var location: Int { get set }
|
var location: Int { get set }
|
||||||
|
|
||||||
|
/// Length from the location.
|
||||||
var length: Int { get set }
|
var length: Int { get set }
|
||||||
|
|
||||||
|
/// Applies the attribute to the attributedString that is given.
|
||||||
|
/// - Parameter attributedString: AttributedString that the attributed is applied.
|
||||||
func setAttribute(on attributedString: NSMutableAttributedString)
|
func setAttribute(on attributedString: NSMutableAttributedString)
|
||||||
}
|
}
|
||||||
|
|
||||||
extension LabelAttributeModel {
|
extension LabelAttributeModel {
|
||||||
|
/// Range for this AttributeModel
|
||||||
public var range: NSRange {
|
public var range: NSRange {
|
||||||
NSRange(location: location, length: length)
|
NSRange(location: location, length: length)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,7 @@ public struct UnderlineLabelAttribute: LabelAttributeModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Functions
|
// MARK: - Public Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public func setAttribute(on attributedString: NSMutableAttributedString) {
|
public func setAttribute(on attributedString: NSMutableAttributedString) {
|
||||||
attributedString.addAttribute(.underlineStyle, value: underlineValue.rawValue, range: range)
|
attributedString.addAttribute(.underlineStyle, value: underlineValue.rawValue, range: range)
|
||||||
|
|||||||
@ -34,8 +34,10 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
|||||||
/// Current Surface and this is used to pass down to child objects that implement Surfacable
|
/// Current Surface and this is used to pass down to child objects that implement Surfacable
|
||||||
open var surface: Surface = .light { didSet { setNeedsUpdate() }}
|
open var surface: Surface = .light { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the text.
|
||||||
open var attributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }}
|
open var attributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
|
/// TextStyle used on the this label.
|
||||||
open var textStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() }}
|
open var textStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
open var edgeInsets: UIEdgeInsets { textStyle.edgeInsets }
|
open var edgeInsets: UIEdgeInsets { textStyle.edgeInsets }
|
||||||
@ -85,7 +87,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Functions
|
// MARK: - Public Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open func initialSetup() {
|
open func initialSetup() {
|
||||||
if !initialSetupPerformed {
|
if !initialSetupPerformed {
|
||||||
@ -135,7 +137,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open func updateView() {
|
open func updateView() {
|
||||||
if !useAttributedText {
|
if !useAttributedText {
|
||||||
if let text = text {
|
if let text = text {
|
||||||
|
|||||||
@ -43,6 +43,7 @@ open class Line: View {
|
|||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
/// The natural size for the receiving view, considering only properties of the view itself.
|
||||||
open override var intrinsicContentSize: CGSize {
|
open override var intrinsicContentSize: CGSize {
|
||||||
if orientation == .vertical {
|
if orientation == .vertical {
|
||||||
return .init(width: 1, height: bounds.height)
|
return .init(width: 1, height: bounds.height)
|
||||||
@ -62,7 +63,7 @@ open class Line: View {
|
|||||||
super.setup()
|
super.setup()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -34,6 +34,7 @@ open class Loader: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The natural size for the receiving view, considering only properties of the view itself.
|
||||||
open override var intrinsicContentSize: CGSize { .init(width: size, height: size) }
|
open override var intrinsicContentSize: CGSize { .init(width: size, height: size) }
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -55,7 +56,7 @@ open class Loader: View {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
icon.color = iconColorConfiguration.getColor(self)
|
icon.color = iconColorConfiguration.getColor(self)
|
||||||
|
|||||||
@ -43,7 +43,7 @@ open class LoaderViewController: UIViewController, Surfaceable {
|
|||||||
updateView()
|
updateView()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open func updateView() {
|
open func updateView() {
|
||||||
view.backgroundColor = backgroundColorConfiguration.getColor(self).withAlphaComponent(0.8)
|
view.backgroundColor = backgroundColorConfiguration.getColor(self).withAlphaComponent(0.8)
|
||||||
if let size {
|
if let size {
|
||||||
|
|||||||
@ -264,7 +264,7 @@ open class Notification: View {
|
|||||||
setNeedsUpdate()
|
setNeedsUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -115,10 +115,13 @@ extension RadioBoxGroup {
|
|||||||
public var value: AnyHashable?
|
public var value: AnyHashable?
|
||||||
public var accessibileText: String?
|
public var accessibileText: String?
|
||||||
public var text: String
|
public var text: String
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the text.
|
||||||
public var textAttributes: [any LabelAttributeModel]?
|
public var textAttributes: [any LabelAttributeModel]?
|
||||||
public var subText: String?
|
public var subText: String?
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the subText.
|
||||||
public var subTextAttributes: [any LabelAttributeModel]?
|
public var subTextAttributes: [any LabelAttributeModel]?
|
||||||
public var subTextRight: String?
|
public var subTextRight: String?
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the subTextRight.
|
||||||
public var subTextRightAttributes: [any LabelAttributeModel]?
|
public var subTextRightAttributes: [any LabelAttributeModel]?
|
||||||
public var selected: Bool
|
public var selected: Bool
|
||||||
|
|
||||||
|
|||||||
@ -88,6 +88,7 @@ open class RadioBoxItem: Control, Changeable {
|
|||||||
|
|
||||||
open var text: String = "Default Text" { didSet { setNeedsUpdate() }}
|
open var text: String = "Default Text" { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the text.
|
||||||
open var textAttributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }}
|
open var textAttributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
open var textAttributedText: NSAttributedString? {
|
open var textAttributedText: NSAttributedString? {
|
||||||
@ -100,6 +101,7 @@ open class RadioBoxItem: Control, Changeable {
|
|||||||
|
|
||||||
open var subText: String? { didSet { setNeedsUpdate() }}
|
open var subText: String? { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the subText.
|
||||||
open var subTextAttributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }}
|
open var subTextAttributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
open var subTextAttributedText: NSAttributedString? {
|
open var subTextAttributedText: NSAttributedString? {
|
||||||
@ -112,6 +114,7 @@ open class RadioBoxItem: Control, Changeable {
|
|||||||
|
|
||||||
open var subTextRight: String? { didSet { setNeedsUpdate() }}
|
open var subTextRight: String? { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the subTextRight.
|
||||||
open var subTextRightAttributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }}
|
open var subTextRightAttributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
open var subTextRightAttributedText: NSAttributedString? {
|
open var subTextRightAttributedText: NSAttributedString? {
|
||||||
@ -259,7 +262,7 @@ open class RadioBoxItem: Control, Changeable {
|
|||||||
sendActions(for: .valueChanged)
|
sendActions(for: .valueChanged)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -124,8 +124,10 @@ extension RadioButtonGroup {
|
|||||||
public var value: AnyHashable?
|
public var value: AnyHashable?
|
||||||
public var accessibileText: String?
|
public var accessibileText: String?
|
||||||
public var labelText: String?
|
public var labelText: String?
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the labelText.
|
||||||
public var labelTextAttributes: [any LabelAttributeModel]?
|
public var labelTextAttributes: [any LabelAttributeModel]?
|
||||||
public var childText: String?
|
public var childText: String?
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the childText.
|
||||||
public var childTextAttributes: [any LabelAttributeModel]?
|
public var childTextAttributes: [any LabelAttributeModel]?
|
||||||
public var selected: Bool
|
public var selected: Bool
|
||||||
public var showError: Bool
|
public var showError: Bool
|
||||||
|
|||||||
@ -125,7 +125,7 @@ open class RadioSwatch: Control {
|
|||||||
sendActions(for: .valueChanged)
|
sendActions(for: .valueChanged)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -124,7 +124,7 @@ open class RadioSwatchGroup: SelectorGroupSelectedHandlerBase<RadioSwatch>, UICo
|
|||||||
collectionView.dataSource = self
|
collectionView.dataSource = self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,7 @@ extension Tabs {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
/// TextStyle used on the label.
|
||||||
private var textStyle: TextStyle {
|
private var textStyle: TextStyle {
|
||||||
if size == .medium {
|
if size == .medium {
|
||||||
return .boldBodyLarge
|
return .boldBodyLarge
|
||||||
@ -145,7 +146,7 @@ extension Tabs {
|
|||||||
labelBottomConstraint = label.pinBottom(anchor: layoutGuide.bottomAnchor, priority: .defaultHigh)
|
labelBottomConstraint = label.pinBottom(anchor: layoutGuide.bottomAnchor, priority: .defaultHigh)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -201,7 +201,7 @@ open class Tabs: View {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -135,7 +135,7 @@ open class TabsContainer: View {
|
|||||||
tabMenuLayoutGuide.pinToSuperView()
|
tabMenuLayoutGuide.pinToSuperView()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -135,6 +135,7 @@ open class EntryField: Control, Changeable {
|
|||||||
|
|
||||||
open var showError: Bool = false { didSet { setNeedsUpdate() }}
|
open var showError: Bool = false { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
|
/// Override UIControl state to add the .error state if showError is true.
|
||||||
open override var state: UIControl.State {
|
open override var state: UIControl.State {
|
||||||
get {
|
get {
|
||||||
var state = super.state
|
var state = super.state
|
||||||
@ -258,7 +259,7 @@ open class EntryField: Control, Changeable {
|
|||||||
readOnly = false
|
readOnly = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -75,6 +75,7 @@ open class InputField: EntryField, UITextFieldDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Override UIControl state to add the .error state if showSuccess is true and if showError is true.
|
||||||
open override var state: UIControl.State {
|
open override var state: UIControl.State {
|
||||||
get {
|
get {
|
||||||
var state = super.state
|
var state = super.state
|
||||||
@ -161,7 +162,7 @@ open class InputField: EntryField, UITextFieldDelegate {
|
|||||||
return inputFieldStackView
|
return inputFieldStackView
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -91,7 +91,7 @@ open class TextArea: EntryField {
|
|||||||
return inputFieldStackView
|
return inputFieldStackView
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -200,7 +200,7 @@ open class TileContainer: Control {
|
|||||||
setNeedsUpdate()
|
setNeedsUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ open class TileContainer: Control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Functions
|
// MARK: - Public Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public func addContentView(_ view: UIView, shouldPin: Bool = true) {
|
public func addContentView(_ view: UIView, shouldPin: Bool = true) {
|
||||||
containerView.addSubview(view)
|
containerView.addSubview(view)
|
||||||
@ -281,7 +281,7 @@ open class TileContainer: Control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Functions
|
// MARK: - Private Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private func ratioSize(for width: CGFloat) -> CGSize {
|
private func ratioSize(for width: CGFloat) -> CGSize {
|
||||||
var height: CGFloat = width
|
var height: CGFloat = width
|
||||||
|
|||||||
@ -365,7 +365,7 @@ open class Tilelet: TileContainer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@ extension Tilelet {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public var text: String = ""
|
public var text: String = ""
|
||||||
public var standardStyle: StandardStyle = .bodySmall
|
public var standardStyle: StandardStyle = .bodySmall
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the text.
|
||||||
public var textAttributes: [any LabelAttributeModel]?
|
public var textAttributes: [any LabelAttributeModel]?
|
||||||
public var textColor: Use = .primary
|
public var textColor: Use = .primary
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ extension Tilelet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Functions
|
// MARK: - Public Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public func toTitleLockupSubTitleModel() -> TitleLockup.SubTitleModel {
|
public func toTitleLockupSubTitleModel() -> TitleLockup.SubTitleModel {
|
||||||
TitleLockup.SubTitleModel(text: text,
|
TitleLockup.SubTitleModel(text: text,
|
||||||
|
|||||||
@ -24,6 +24,7 @@ extension Tilelet {
|
|||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public var text: String = ""
|
public var text: String = ""
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the text.
|
||||||
public var textAttributes: [any LabelAttributeModel]?
|
public var textAttributes: [any LabelAttributeModel]?
|
||||||
public var standardStyle: StandardStyle = .titleSmall
|
public var standardStyle: StandardStyle = .titleSmall
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ extension Tilelet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Functions
|
// MARK: - Public Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public func toTitleLockupTitleModel() -> TitleLockup.TitleModel {
|
public func toTitleLockupTitleModel() -> TitleLockup.TitleModel {
|
||||||
TitleLockup.TitleModel(text: text,
|
TitleLockup.TitleModel(text: text,
|
||||||
|
|||||||
@ -288,7 +288,7 @@ open class TitleLockup: View {
|
|||||||
setNeedsUpdate()
|
setNeedsUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ extension TitleLockup {
|
|||||||
public struct EyebrowModel {
|
public struct EyebrowModel {
|
||||||
public var text: String
|
public var text: String
|
||||||
public var isBold: Bool
|
public var isBold: Bool
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the text.
|
||||||
public var textAttributes: [any LabelAttributeModel]?
|
public var textAttributes: [any LabelAttributeModel]?
|
||||||
public var standardStyle: OtherStandardStyle
|
public var standardStyle: OtherStandardStyle
|
||||||
public var numberOfLines: Int
|
public var numberOfLines: Int
|
||||||
|
|||||||
@ -12,6 +12,7 @@ extension TitleLockup {
|
|||||||
public var text: String
|
public var text: String
|
||||||
public var standardStyle: OtherStandardStyle
|
public var standardStyle: OtherStandardStyle
|
||||||
public var textColor: Use
|
public var textColor: Use
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the text.
|
||||||
public var textAttributes: [any LabelAttributeModel]?
|
public var textAttributes: [any LabelAttributeModel]?
|
||||||
public var numberOfLines: Int
|
public var numberOfLines: Int
|
||||||
|
|
||||||
@ -27,6 +28,7 @@ extension TitleLockup {
|
|||||||
self.numberOfLines = numberOfLines
|
self.numberOfLines = numberOfLines
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// TextStyle used to render the text.
|
||||||
public var textStyle: TextStyle { standardStyle.value.regular }
|
public var textStyle: TextStyle { standardStyle.value.regular }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import Foundation
|
|||||||
extension TitleLockup {
|
extension TitleLockup {
|
||||||
public struct TitleModel {
|
public struct TitleModel {
|
||||||
public var text: String
|
public var text: String
|
||||||
|
/// Array of LabelAttributeModel objects used in rendering the text.
|
||||||
public var textAttributes: [any LabelAttributeModel]?
|
public var textAttributes: [any LabelAttributeModel]?
|
||||||
public var isBold: Bool
|
public var isBold: Bool
|
||||||
public var standardStyle: TitleStandardStyle
|
public var standardStyle: TitleStandardStyle
|
||||||
@ -26,7 +27,8 @@ extension TitleLockup {
|
|||||||
self.standardStyle = standardStyle
|
self.standardStyle = standardStyle
|
||||||
self.numberOfLines = numberOfLines
|
self.numberOfLines = numberOfLines
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// TextStyle used to render the text.
|
||||||
public var textStyle: TextStyle { isBold ? standardStyle.value.bold : standardStyle.value.regular }
|
public var textStyle: TextStyle { isBold ? standardStyle.value.bold : standardStyle.value.regular }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,6 +56,7 @@ open class Toggle: Control, Changeable {
|
|||||||
private let spacingBetween = VDSLayout.Spacing.space3X.value
|
private let spacingBetween = VDSLayout.Spacing.space3X.value
|
||||||
private let labelMaxWidth = 40.0
|
private let labelMaxWidth = 40.0
|
||||||
|
|
||||||
|
/// TextStyle used to render the label.
|
||||||
private var textStyle: TextStyle {
|
private var textStyle: TextStyle {
|
||||||
if textSize == .small {
|
if textSize == .small {
|
||||||
if textWeight == .bold {
|
if textWeight == .bold {
|
||||||
@ -194,7 +195,7 @@ open class Toggle: Control, Changeable {
|
|||||||
setNeedsUpdate()
|
setNeedsUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
@ -255,7 +256,7 @@ open class Toggle: Control, Changeable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
/// The natural size for the receiving view, considering only properties of the view itself.
|
||||||
open override var intrinsicContentSize: CGSize {
|
open override var intrinsicContentSize: CGSize {
|
||||||
if showLabel {
|
if showLabel {
|
||||||
label.sizeToFit()
|
label.sizeToFit()
|
||||||
|
|||||||
@ -165,7 +165,7 @@ open class ToggleView: Control, Changeable {
|
|||||||
setNeedsUpdate()
|
setNeedsUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
@ -187,6 +187,7 @@ open class ToggleView: Control, Changeable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
/// The natural size for the receiving view, considering only properties of the view itself.
|
||||||
open override var intrinsicContentSize: CGSize { toggleSize }
|
open override var intrinsicContentSize: CGSize { toggleSize }
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -143,7 +143,7 @@ open class Tooltip: Control, TooltipLaunchable {
|
|||||||
setNeedsUpdate()
|
setNeedsUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -105,7 +105,7 @@ open class TooltipAlertViewController: UIViewController, Surfaceable {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open func updateView() {
|
open func updateView() {
|
||||||
view.backgroundColor = backgroundColorConfiguration.getColor(self).withAlphaComponent(0.3)
|
view.backgroundColor = backgroundColorConfiguration.getColor(self).withAlphaComponent(0.3)
|
||||||
tooltipDialog.surface = surface
|
tooltipDialog.surface = surface
|
||||||
|
|||||||
@ -120,7 +120,7 @@ open class TooltipDialog: View, UIScrollViewDelegate {
|
|||||||
heightConstraint?.activate()
|
heightConstraint?.activate()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,7 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
|
|||||||
}.store(in: &subscribers)
|
}.store(in: &subscribers)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import VDSColorTokens
|
|||||||
|
|
||||||
extension UIColor {
|
extension UIColor {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Functions
|
// MARK: - Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
/// Convenience to get a grayscale UIColor where the same value is used for red, green, and blue
|
/// Convenience to get a grayscale UIColor where the same value is used for red, green, and blue
|
||||||
|
|||||||
@ -19,7 +19,7 @@ public protocol ViewProtocol: AnyObject, Initable, Resettable, Enabling, Surface
|
|||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||||
func setup()
|
func setup()
|
||||||
|
|
||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
func updateView()
|
func updateView()
|
||||||
|
|
||||||
/// Used to update any Accessibility properties.
|
/// Used to update any Accessibility properties.
|
||||||
@ -27,7 +27,7 @@ public protocol ViewProtocol: AnyObject, Initable, Resettable, Enabling, Surface
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension ViewProtocol {
|
extension ViewProtocol {
|
||||||
/// Function called when there are changes in a View based off a change events or from local properties.
|
/// Called when there are changes in a View based off a change events or from local properties.
|
||||||
public func setNeedsUpdate() {
|
public func setNeedsUpdate() {
|
||||||
if shouldUpdateView {
|
if shouldUpdateView {
|
||||||
shouldUpdateView = false
|
shouldUpdateView = false
|
||||||
@ -50,7 +50,7 @@ extension ViewProtocol where Self: UIView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension ViewProtocol where Self: UIControl {
|
extension ViewProtocol where Self: UIControl {
|
||||||
/// Helper function to assign a completion block to a specific UIControl Event using Combine and stored in the subscribers.
|
/// Helper method to assign a completion block to a specific UIControl Event using Combine and stored in the subscribers.
|
||||||
public func addEvent(event: UIControl.Event, block: @escaping (Self)->()) {
|
public func addEvent(event: UIControl.Event, block: @escaping (Self)->()) {
|
||||||
publisher(for: event)
|
publisher(for: event)
|
||||||
.sink(receiveValue: { c in
|
.sink(receiveValue: { c in
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user