public to open

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-04 16:01:38 -05:00
parent 4aa2e0d929
commit 56c2217b0c
38 changed files with 99 additions and 64 deletions

View File

@ -26,8 +26,8 @@ public typealias ObjectColorable = Colorable & Initable & ObjectWithable
/// You can pass in a Surfaceable object and this will return the corresponding Color based on the object's surface property. /// You can pass in a Surfaceable object and this will return the corresponding Color based on the object's surface property.
open class SurfaceColorConfiguration: ObjectColorable { open class SurfaceColorConfiguration: ObjectColorable {
public typealias ObjectType = Surfaceable public typealias ObjectType = Surfaceable
public var lightColor: UIColor = .clear open var lightColor: UIColor = .clear
public var darkColor: UIColor = .clear open var darkColor: UIColor = .clear
required public init(){} required public init(){}

View File

@ -17,9 +17,9 @@ open class Control: UIControl, Handlerable, ViewProtocol, Resettable, UserInfoab
// MARK: - Combine Properties // MARK: - Combine Properties
//-------------------------------------------------- //--------------------------------------------------
/// Set of Subscribers for any Publishers for this Control. /// Set of Subscribers for any Publishers for this Control.
public var subscribers = Set<AnyCancellable>() open var subscribers = Set<AnyCancellable>()
public var onClickSubscriber: AnyCancellable? { open var onClickSubscriber: AnyCancellable? {
willSet { willSet {
if let onClickSubscriber { if let onClickSubscriber {
onClickSubscriber.cancel() onClickSubscriber.cancel()
@ -40,6 +40,7 @@ open class Control: UIControl, Handlerable, ViewProtocol, Resettable, UserInfoab
/// 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() } }
/// Whether this object is disabled or not
open var disabled: Bool { open var disabled: Bool {
get { !isEnabled } get { !isEnabled }
set { set {
@ -52,7 +53,7 @@ open class Control: UIControl, Handlerable, ViewProtocol, Resettable, UserInfoab
/// Override for isSelected to handle setNeedsUpdate() on changes. /// Override for isSelected to handle setNeedsUpdate() on changes.
open override var isSelected: Bool { didSet { setNeedsUpdate() } } open override var isSelected: Bool { didSet { setNeedsUpdate() } }
public var touchUpInsideCount: Int = 0 open var touchUpInsideCount: Int = 0
var isHighlightAnimating = false var isHighlightAnimating = false

View File

@ -20,7 +20,7 @@ public protocol SelectorControlable: Control, Changeable {
open class SelectorBase: Control, SelectorControlable { open class SelectorBase: Control, SelectorControlable {
public var onChangeSubscriber: AnyCancellable? { open var onChangeSubscriber: AnyCancellable? {
willSet { willSet {
if let onChangeSubscriber { if let onChangeSubscriber {
onChangeSubscriber.cancel() onChangeSubscriber.cancel()

View File

@ -17,10 +17,10 @@ open class SelectorGroupHandlerBase<HandlerType: Control>: Control, Changeable {
//-------------------------------------------------- //--------------------------------------------------
/// Array of the HandlerType registered. /// Array of the HandlerType registered.
public var selectorViews: [HandlerType] = [] open var selectorViews: [HandlerType] = []
/// The primary subscriber for onChange or the UIControl valueChanged event. /// The primary subscriber for onChange or the UIControl valueChanged event.
public var onChangeSubscriber: AnyCancellable? { open var onChangeSubscriber: AnyCancellable? {
willSet { willSet {
if let onChangeSubscriber { if let onChangeSubscriber {
onChangeSubscriber.cancel() onChangeSubscriber.cancel()
@ -28,8 +28,8 @@ open class SelectorGroupHandlerBase<HandlerType: Control>: Control, Changeable {
} }
} }
/// Override to update the child SelectorViews disabled property for this group. /// Whether this object is disabled or not
override public var disabled: Bool { override open var disabled: Bool {
didSet { didSet {
selectorViews.forEach { handler in selectorViews.forEach { handler in
handler.disabled = disabled handler.disabled = disabled
@ -38,7 +38,7 @@ open class SelectorGroupHandlerBase<HandlerType: Control>: Control, Changeable {
} }
/// 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.
override public var surface: Surface { override open var surface: Surface {
didSet { didSet {
selectorViews.forEach { handler in selectorViews.forEach { handler in
handler.surface = surface handler.surface = surface
@ -57,7 +57,7 @@ open class SelectorGroupHandlerBase<HandlerType: Control>: Control, Changeable {
} }
/// Helper method to execute the valueChanged event. /// Helper method to execute the valueChanged event.
public func valueChanged() { open func valueChanged() {
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100)) { [weak self] in DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100)) { [weak self] in
self?.sendActions(for: .valueChanged) self?.sendActions(for: .valueChanged)
} }

View File

@ -18,7 +18,7 @@ open class View: UIView, Handlerable, ViewProtocol, Resettable, UserInfoable {
// MARK: - Combine Properties // MARK: - Combine Properties
//-------------------------------------------------- //--------------------------------------------------
/// Set of Subscribers for any Publishers for this Control. /// Set of Subscribers for any Publishers for this Control.
public var subscribers = Set<AnyCancellable>() open var subscribers = Set<AnyCancellable>()
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties

View File

@ -149,6 +149,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.
open override func updateView() { open override func updateView() {
super.updateView() super.updateView()
let bgColor = backgroundColorConfiguration.getColor(self) let bgColor = backgroundColorConfiguration.getColor(self)

View File

@ -29,9 +29,9 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
// MARK: - Combine Properties // MARK: - Combine Properties
//-------------------------------------------------- //--------------------------------------------------
/// Set of Subscribers for any Publishers for this Control. /// Set of Subscribers for any Publishers for this Control.
public var subscribers = Set<AnyCancellable>() open var subscribers = Set<AnyCancellable>()
public var onClickSubscriber: AnyCancellable? { open var onClickSubscriber: AnyCancellable? {
willSet { willSet {
if let onClickSubscriber { if let onClickSubscriber {
onClickSubscriber.cancel() onClickSubscriber.cancel()
@ -63,7 +63,7 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
open var userInfo = [String: Primitive]() open var userInfo = [String: Primitive]()
public var touchUpInsideCount: Int = 0 open var touchUpInsideCount: Int = 0
internal var isHighlightAnimating = false internal var isHighlightAnimating = false
@ -160,6 +160,7 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
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.
open func updateView() { open func updateView() {
updateLabel() updateLabel()
updateAccessibility() updateAccessibility()

View File

@ -29,7 +29,7 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
open var rowQuantityTablet: Int = 0 { didSet { setNeedsUpdate() } } open var rowQuantityTablet: Int = 0 { didSet { setNeedsUpdate() } }
public var rowQuantity: Int { UIDevice.isIPad ? rowQuantityTablet : rowQuantityPhone } open var rowQuantity: Int { UIDevice.isIPad ? rowQuantityTablet : rowQuantityPhone }
//If provided, aligns TextLink/TextLinkCaret alignment when rowQuantity is set one. //If provided, aligns TextLink/TextLinkCaret alignment when rowQuantity is set one.
open var buttonPosition: ButtonPosition = .center { didSet { setNeedsUpdate() }} open var buttonPosition: ButtonPosition = .center { didSet { setNeedsUpdate() }}
@ -93,7 +93,8 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Overrides // MARK: - Overrides
//-------------------------------------------------- //--------------------------------------------------
override public var disabled: Bool { /// Whether this object is disabled or not
override open var disabled: Bool {
didSet { didSet {
buttons.forEach { button in buttons.forEach { button in
var b = button var b = button
@ -103,7 +104,7 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
} }
/// 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
override public var surface: Surface { override open var surface: Surface {
didSet { didSet {
buttons.forEach { button in buttons.forEach { button in
var b = button var b = button
@ -138,6 +139,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.
open override func updateView() { open override func updateView() {
super.updateView() super.updateView()
positionLayout.position = buttonPosition positionLayout.position = buttonPosition

View File

@ -107,6 +107,7 @@ open class TextLink: ButtonBase {
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.
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

View File

@ -94,6 +94,7 @@ open class TextLinkCaret: ButtonBase {
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.
open override func updateView() { open override func updateView() {
imageAttribute = CaretLabelAttribute(tintColor: textColor, position: iconPosition) imageAttribute = CaretLabelAttribute(tintColor: textColor, position: iconPosition)
super.updateView() super.updateView()

View File

@ -14,13 +14,13 @@ open class CheckboxGroup: SelectorGroupHandlerBase<CheckboxItem> {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
public var selectedHandlers: [CheckboxItem]? { open var selectedHandlers: [CheckboxItem]? {
let selected = selectorViews.filter{ $0.isSelected == true } let selected = selectorViews.filter{ $0.isSelected == true }
guard selected.count > 0 else { return nil } guard selected.count > 0 else { return nil }
return selected return selected
} }
public override var selectorViews: [CheckboxItem] { open override var selectorViews: [CheckboxItem] {
willSet { willSet {
mainStackView.arrangedSubviews.forEach { $0.removeFromSuperview() } mainStackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
} }
@ -35,7 +35,7 @@ open class CheckboxGroup: SelectorGroupHandlerBase<CheckboxItem> {
} }
} }
public var selectorModels: [CheckboxModel]? { open var selectorModels: [CheckboxModel]? {
didSet { didSet {
if let selectorModels { if let selectorModels {
selectorViews = selectorModels.enumerated().map { index, model in selectorViews = selectorModels.enumerated().map { index, model in
@ -61,7 +61,7 @@ open class CheckboxGroup: SelectorGroupHandlerBase<CheckboxItem> {
} }
private var _showError: Bool = false private var _showError: Bool = false
public var showError: Bool { open var showError: Bool {
get { _showError } get { _showError }
set { set {
var newShowError = newValue var newShowError = newValue
@ -112,6 +112,7 @@ open class CheckboxGroup: SelectorGroupHandlerBase<CheckboxItem> {
extension CheckboxGroup { extension CheckboxGroup {
public struct CheckboxModel : Surfaceable, Disabling, Initable, FormFieldable, Errorable { public struct CheckboxModel : Surfaceable, Disabling, Initable, FormFieldable, Errorable {
/// Whether this object is disabled or not
public var disabled: Bool public var disabled: Bool
/// 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
public var surface: Surface public var surface: Surface

View File

@ -44,6 +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.
open override func updateView() { open override func updateView() {
selectorView.isAnimated = isAnimated selectorView.isAnimated = isAnimated
super.updateView() super.updateView()

View File

@ -268,6 +268,7 @@ open class ButtonIcon: Control {
setNeedsUpdate() setNeedsUpdate()
} }
/// Function 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()

View File

@ -69,6 +69,7 @@ open class Icon: View {
imageView.image = nil imageView.image = nil
} }
/// Function 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

View File

@ -17,7 +17,7 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
// MARK: - Combine Properties // MARK: - Combine Properties
//-------------------------------------------------- //--------------------------------------------------
/// Set of Subscribers for any Publishers for this Control. /// Set of Subscribers for any Publishers for this Control.
public var subscribers = Set<AnyCancellable>() open var subscribers = Set<AnyCancellable>()
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties
@ -66,7 +66,7 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Configuration Properties // MARK: - Configuration Properties
//-------------------------------------------------- //--------------------------------------------------
public var textColorConfiguration: AnyColorable = ViewColorConfiguration().with { open var textColorConfiguration: AnyColorable = ViewColorConfiguration().with {
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true) $0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false) $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false)
}.eraseToAnyColorable(){ didSet { setNeedsUpdate() }} }.eraseToAnyColorable(){ didSet { setNeedsUpdate() }}
@ -139,7 +139,8 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Overrides // MARK: - Overrides
//-------------------------------------------------- //--------------------------------------------------
/// Function 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 {

View File

@ -31,7 +31,7 @@ open class Line: View {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Configuration // MARK: - Configuration
//-------------------------------------------------- //--------------------------------------------------
public var lineViewColorConfiguration: AnyColorable = { open var lineViewColorConfiguration: AnyColorable = {
let config = KeyedColorConfiguration<Line, Style>(keyPath: \.style) let config = KeyedColorConfiguration<Line, Style>(keyPath: \.style)
config.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forKey: .primary) config.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forKey: .primary)
config.setSurfaceColors(VDSColor.elementsLowcontrastOnlight, VDSColor.elementsLowcontrastOndark, forKey: .secondary) config.setSurfaceColors(VDSColor.elementsLowcontrastOnlight, VDSColor.elementsLowcontrastOndark, forKey: .secondary)
@ -56,6 +56,7 @@ open class Line: View {
style = .primary style = .primary
} }
/// Function used to make changes to the View based off a change events or from local properties.
open override func updateView() { open override func updateView() {
lineView.backgroundColor = lineViewColorConfiguration.getColor(self) lineView.backgroundColor = lineViewColorConfiguration.getColor(self)
} }

View File

@ -24,10 +24,10 @@ open class Loader: View {
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
/// Loader will be active if 'active' prop is passed. /// Loader will be active if 'active' prop is passed.
public var isActive: Bool = true { didSet { setNeedsUpdate() } } open var isActive: Bool = true { didSet { setNeedsUpdate() } }
/// The Int used to determine the height and width of the Loader /// The Int used to determine the height and width of the Loader
public var size: Int = 40 { didSet { setNeedsUpdate() } } open var size: Int = 40 { didSet { setNeedsUpdate() } }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Lifecycle // MARK: - Lifecycle
@ -46,6 +46,7 @@ open class Loader: View {
]) ])
} }
/// Function 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)

View File

@ -43,7 +43,7 @@ open class LoaderViewController: UIViewController, Surfaceable {
updateView() updateView()
} }
/// Update this view based off of property chang /// Function 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 {

View File

@ -264,6 +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.
open override func updateView() { open override func updateView() {
backgroundColor = backgroundColorConfiguration.getColor(self) backgroundColor = backgroundColorConfiguration.getColor(self)
updateIcons() updateIcons()

View File

@ -30,7 +30,7 @@ open class RadioBoxGroup: SelectorGroupSelectedHandlerBase<RadioBoxItem> {
} }
} }
public var selectorModels: [RadioBoxModel]? { open var selectorModels: [RadioBoxModel]? {
didSet { didSet {
if let selectorModels { if let selectorModels {
selectorViews = selectorModels.enumerated().map { index, model in selectorViews = selectorModels.enumerated().map { index, model in
@ -107,6 +107,7 @@ open class RadioBoxGroup: SelectorGroupSelectedHandlerBase<RadioBoxItem> {
extension RadioBoxGroup { extension RadioBoxGroup {
public struct RadioBoxModel: Surfaceable, Initable, Disabling, FormFieldable { public struct RadioBoxModel: Surfaceable, Initable, Disabling, FormFieldable {
/// Whether this object is disabled or not
public var disabled: Bool public var disabled: Bool
/// 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
public var surface: Surface public var surface: Surface

View File

@ -56,7 +56,7 @@ open class RadioBoxItem: Control, Changeable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
public var onChangeSubscriber: AnyCancellable? { open var onChangeSubscriber: AnyCancellable? {
willSet { willSet {
if let onChangeSubscriber { if let onChangeSubscriber {
onChangeSubscriber.cancel() onChangeSubscriber.cancel()
@ -82,7 +82,7 @@ open class RadioBoxItem: Control, Changeable {
$0.textStyle = .bodyLarge $0.textStyle = .bodyLarge
} }
public var selectorView = UIView().with { open var selectorView = UIView().with {
$0.translatesAutoresizingMaskIntoConstraints = false $0.translatesAutoresizingMaskIntoConstraints = false
} }
@ -259,6 +259,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.
open override func updateView() { open override func updateView() {
updateLabels() updateLabels()
updateAccessibility() updateAccessibility()

View File

@ -30,7 +30,7 @@ open class RadioButtonGroup: SelectorGroupSelectedHandlerBase<RadioButtonItem> {
} }
} }
public var selectorModels: [RadioButtonModel]? { open var selectorModels: [RadioButtonModel]? {
didSet { didSet {
if let selectorModels { if let selectorModels {
selectorViews = selectorModels.enumerated().map { index, model in selectorViews = selectorModels.enumerated().map { index, model in
@ -56,7 +56,7 @@ open class RadioButtonGroup: SelectorGroupSelectedHandlerBase<RadioButtonItem> {
} }
private var _showError: Bool = false private var _showError: Bool = false
public var showError: Bool { open var showError: Bool {
get { _showError } get { _showError }
set { set {
var newShowError = newValue var newShowError = newValue
@ -116,6 +116,7 @@ open class RadioButtonGroup: SelectorGroupSelectedHandlerBase<RadioButtonItem> {
extension RadioButtonGroup { extension RadioButtonGroup {
public struct RadioButtonModel: Surfaceable, Disabling, Initable, FormFieldable, Errorable { public struct RadioButtonModel: Surfaceable, Disabling, Initable, FormFieldable, Errorable {
/// Whether this object is disabled or not
public var disabled: Bool public var disabled: Bool
/// 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
public var surface: Surface public var surface: Surface

View File

@ -32,11 +32,11 @@ open class RadioSwatch: Control {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
public var selectorView = UIView().with { open var selectorView = UIView().with {
$0.translatesAutoresizingMaskIntoConstraints = false $0.translatesAutoresizingMaskIntoConstraints = false
} }
public var fillView = UIImageView().with { open var fillView = UIImageView().with {
$0.translatesAutoresizingMaskIntoConstraints = false $0.translatesAutoresizingMaskIntoConstraints = false
$0.contentMode = .scaleAspectFit $0.contentMode = .scaleAspectFit
} }
@ -125,6 +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.
open override func updateView() { open override func updateView() {
layer.setNeedsDisplay() layer.setNeedsDisplay()
} }

View File

@ -21,7 +21,7 @@ open class RadioSwatchGroup: SelectorGroupSelectedHandlerBase<RadioSwatch>, UICo
} }
} }
public var selectorModels: [RadioSwatchModel]? { open var selectorModels: [RadioSwatchModel]? {
didSet { didSet {
if let selectorModels { if let selectorModels {
selectorViews = selectorModels.map { model in selectorViews = selectorModels.map { model in
@ -46,7 +46,7 @@ open class RadioSwatchGroup: SelectorGroupSelectedHandlerBase<RadioSwatch>, UICo
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Private Properties // MARK: - Private Properties
//-------------------------------------------------- //--------------------------------------------------
public var label = Label() open var label = Label()
private let cellSize: CGFloat = 48.0 private let cellSize: CGFloat = 48.0
private let labelSpacing: CGFloat = 24.0 private let labelSpacing: CGFloat = 24.0
private let labelHeight: CGFloat = 16.0 private let labelHeight: CGFloat = 16.0
@ -71,6 +71,7 @@ open class RadioSwatchGroup: SelectorGroupSelectedHandlerBase<RadioSwatch>, UICo
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Overrides // MARK: - Overrides
//-------------------------------------------------- //--------------------------------------------------
/// Whether this object is disabled or not
override public var disabled: Bool { override public var disabled: Bool {
didSet { didSet {
for selector in selectorViews { for selector in selectorViews {
@ -123,6 +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.
open override func updateView() { open override func updateView() {
label.textPosition = .left label.textPosition = .left
label.textStyle = .bodySmall label.textStyle = .bodySmall
@ -190,7 +192,9 @@ open class RadioSwatchGroup: SelectorGroupSelectedHandlerBase<RadioSwatch>, UICo
extension RadioSwatchGroup { extension RadioSwatchGroup {
public struct RadioSwatchModel: Surfaceable, Disabling, Initable { public struct RadioSwatchModel: Surfaceable, Disabling, Initable {
/// Whether this object is disabled or not
public var disabled: Bool = false public var disabled: Bool = false
/// Current Surface and this is used to pass down to child objects that implement Surfacable
public var surface: Surface public var surface: Surface
public var inputId: String? public var inputId: String?
public var value: AnyHashable? public var value: AnyHashable?

View File

@ -146,6 +146,7 @@ extension Tabs {
layoutGuide.trailingAnchor.constraint(equalTo: trailingAnchor)]) layoutGuide.trailingAnchor.constraint(equalTo: trailingAnchor)])
} }
/// Function 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()

View File

@ -232,6 +232,7 @@ open class Tabs: View {
} }
} }
/// Function 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()

View File

@ -140,6 +140,7 @@ open class TabsContainer: View {
]) ])
} }
/// Function 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()

View File

@ -98,7 +98,7 @@ open class EntryField: Control, Changeable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
public var onChangeSubscriber: AnyCancellable? { open var onChangeSubscriber: AnyCancellable? {
willSet { willSet {
if let onChangeSubscriber { if let onChangeSubscriber {
onChangeSubscriber.cancel() onChangeSubscriber.cancel()
@ -258,9 +258,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.
// MARK: - State
//--------------------------------------------------
open override func updateView() { open override func updateView() {
containerView.backgroundColor = backgroundColorConfiguration.getColor(self) containerView.backgroundColor = backgroundColorConfiguration.getColor(self)

View File

@ -103,7 +103,7 @@ open class InputField: EntryField, UITextFieldDelegate {
$0.font = TextStyle.bodyLarge.font $0.font = TextStyle.bodyLarge.font
} }
public var textFieldTextColorConfiguration: AnyColorable = ViewColorConfiguration().with { open var textFieldTextColorConfiguration: AnyColorable = ViewColorConfiguration().with {
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true) $0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false) $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false)
}.eraseToAnyColorable() }.eraseToAnyColorable()
@ -161,6 +161,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.
open override func updateView() { open override func updateView() {
super.updateView() super.updateView()

View File

@ -53,10 +53,10 @@ open class TextArea: EntryField {
$0.isScrollEnabled = false $0.isScrollEnabled = false
} }
public var textViewTextColorConfiguration: AnyColorable = ViewColorConfiguration().with { open var textViewTextColorConfiguration: AnyColorable = ViewColorConfiguration().with {
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true) $0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false) $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false)
}.eraseToAnyColorable() }.eraseToAnyColorable() { didSet { setNeedsUpdate() }}
internal var minWidthConstraint: NSLayoutConstraint? internal var minWidthConstraint: NSLayoutConstraint?
internal var textViewHeightConstraint: NSLayoutConstraint? internal var textViewHeightConstraint: NSLayoutConstraint?
@ -91,6 +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.
open override func updateView() { open override func updateView() {
super.updateView() super.updateView()

View File

@ -77,26 +77,26 @@ open class TileContainer: Control {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
public var backgroundImage: UIImage? { didSet{ setNeedsUpdate() } } open var backgroundImage: UIImage? { didSet{ setNeedsUpdate() } }
public var containerView = View().with { open var containerView = View().with {
$0.isUserInteractionEnabled = false $0.isUserInteractionEnabled = false
} }
public var highlightView = View().with { open var highlightView = View().with {
$0.isUserInteractionEnabled = false $0.isUserInteractionEnabled = false
} }
public var color: BackgroundColor = .white { didSet{ setNeedsUpdate() } } open var color: BackgroundColor = .white { didSet{ setNeedsUpdate() } }
public var padding: Padding = .padding4X { didSet{ setNeedsUpdate() } } open var padding: Padding = .padding4X { didSet{ setNeedsUpdate() } }
public var aspectRatio: AspectRatio = .ratio1x1 { didSet{ setNeedsUpdate() } } open var aspectRatio: AspectRatio = .ratio1x1 { didSet{ setNeedsUpdate() } }
public var imageFallbackColor: Surface = .light { didSet{ setNeedsUpdate() } } open var imageFallbackColor: Surface = .light { didSet{ setNeedsUpdate() } }
private var _width: CGFloat? private var _width: CGFloat?
public var width: CGFloat? { open var width: CGFloat? {
get { return _width } get { return _width }
set { set {
if let newValue, newValue > 100 { if let newValue, newValue > 100 {
@ -109,7 +109,7 @@ open class TileContainer: Control {
} }
private var _height: CGFloat? private var _height: CGFloat?
public var height: CGFloat? { open var height: CGFloat? {
get { return _height } get { return _height }
set { set {
if let newValue, newValue > 44 { if let newValue, newValue > 44 {
@ -121,9 +121,9 @@ open class TileContainer: Control {
} }
} }
public var showBorder: Bool = false { didSet{ setNeedsUpdate() } } open var showBorder: Bool = false { didSet{ setNeedsUpdate() } }
public var showDropShadows: Bool = false { didSet{ setNeedsUpdate() } } open var showDropShadows: Bool = false { didSet{ setNeedsUpdate() } }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Private Properties // MARK: - Private Properties
@ -204,6 +204,7 @@ open class TileContainer: Control {
setNeedsUpdate() setNeedsUpdate()
} }
/// Function 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()

View File

@ -162,13 +162,13 @@ open class Tilelet: TileContainer {
open var textPostion: TextPosition = .top { didSet { setNeedsUpdate() }} open var textPostion: TextPosition = .top { didSet { setNeedsUpdate() }}
//models //models
public var badgeModel: BadgeModel? { didSet { setNeedsUpdate() }} open var badgeModel: BadgeModel? { didSet { setNeedsUpdate() }}
public var titleModel: TitleModel? { didSet { setNeedsUpdate() }} open var titleModel: TitleModel? { didSet { setNeedsUpdate() }}
public var subTitleModel: SubTitleModel? { didSet { setNeedsUpdate() }} open var subTitleModel: SubTitleModel? { didSet { setNeedsUpdate() }}
//only 1 Icon can be active //only 1 Icon can be active
private var _descriptiveIconModel: DescriptiveIcon? private var _descriptiveIconModel: DescriptiveIcon?
public var descriptiveIconModel: DescriptiveIcon? { open var descriptiveIconModel: DescriptiveIcon? {
get { _descriptiveIconModel } get { _descriptiveIconModel }
set { set {
_descriptiveIconModel = newValue; _descriptiveIconModel = newValue;
@ -178,7 +178,7 @@ open class Tilelet: TileContainer {
} }
private var _directionalIconModel: DirectionalIcon? private var _directionalIconModel: DirectionalIcon?
public var directionalIconModel: DirectionalIcon? { open var directionalIconModel: DirectionalIcon? {
get { _directionalIconModel } get { _directionalIconModel }
set { set {
_directionalIconModel = newValue; _directionalIconModel = newValue;
@ -365,6 +365,7 @@ open class Tilelet: TileContainer {
} }
} }
/// Function 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()

View File

@ -285,6 +285,7 @@ open class TitleLockup: View {
setNeedsUpdate() setNeedsUpdate()
} }
/// Function 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()

View File

@ -191,6 +191,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.
open override func updateView() { open override func updateView() {
updateLabel() updateLabel()
toggleView.surface = surface toggleView.surface = surface

View File

@ -53,7 +53,7 @@ open class ToggleView: Control, Changeable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
public var onChangeSubscriber: AnyCancellable? open var onChangeSubscriber: AnyCancellable?
open var isOn: Bool { open var isOn: Bool {
get { isSelected } get { isSelected }
@ -152,6 +152,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.
open override func updateView() { open override func updateView() {
updateToggle() updateToggle()
updateAccessibility() updateAccessibility()

View File

@ -154,6 +154,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.
open override func updateView() { open override func updateView() {
super.updateView() super.updateView()

View File

@ -13,7 +13,7 @@ import VDSColorTokens
open class TooltipAlertViewController: UIViewController, Surfaceable { open class TooltipAlertViewController: UIViewController, Surfaceable {
/// Set of Subscribers for any Publishers for this Control. /// Set of Subscribers for any Publishers for this Control.
public var subscribers = Set<AnyCancellable>() open var subscribers = Set<AnyCancellable>()
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Private Properties // MARK: - Private Properties
@ -105,6 +105,7 @@ open class TooltipAlertViewController: UIViewController, Surfaceable {
]) ])
} }
/// Function 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
@ -222,6 +223,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.
open override func updateView() { open override func updateView() {
super.updateView() super.updateView()

View File

@ -62,6 +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.
open override func updateView() { open override func updateView() {
super.updateView() super.updateView()