refactored ViewProtocol
removed @objcMembers from components Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
7dc21628af
commit
bf9562d264
@ -226,9 +226,9 @@
|
|||||||
EA3361B4288B2A360071C351 /* Classes */ = {
|
EA3361B4288B2A360071C351 /* Classes */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
EA3361B5288B2A410071C351 /* VDSControl.swift */,
|
|
||||||
EA3C3B4B2894823E000CA526 /* AnyProxy-PropertyWrapper.swift */,
|
EA3C3B4B2894823E000CA526 /* AnyProxy-PropertyWrapper.swift */,
|
||||||
EAF7F09D289AAEC000B287F5 /* VDSConstants.swift */,
|
EAF7F09D289AAEC000B287F5 /* VDSConstants.swift */,
|
||||||
|
EA3361B5288B2A410071C351 /* VDSControl.swift */,
|
||||||
EAF7F09F289AB7EC00B287F5 /* VDSView.swift */,
|
EAF7F09F289AB7EC00B287F5 /* VDSView.swift */,
|
||||||
);
|
);
|
||||||
path = Classes;
|
path = Classes;
|
||||||
|
|||||||
@ -52,10 +52,10 @@ open class VDSControl<ModelType: Initable>: UIControl, ModelHandlerable, ViewPro
|
|||||||
public func initialSetup() {
|
public func initialSetup() {
|
||||||
if !initialSetupPerformed {
|
if !initialSetupPerformed {
|
||||||
initialSetupPerformed = true
|
initialSetupPerformed = true
|
||||||
setupView()
|
cancellable = $model.debounce(for: .seconds(VDSConstants.ModelStateDebounce), scheduler: RunLoop.main).sink { [weak self] viewModel in
|
||||||
}
|
self?.onStateChange(viewModel: viewModel)
|
||||||
cancellable = $model.debounce(for: .seconds(VDSConstants.ModelStateDebounce), scheduler: RunLoop.main).sink { [weak self] viewModel in
|
}
|
||||||
self?.onStateChange(viewModel: viewModel)
|
setup()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,11 +63,9 @@ open class VDSControl<ModelType: Initable>: UIControl, ModelHandlerable, ViewPro
|
|||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - ViewProtocol
|
// MARK: - ViewProtocol
|
||||||
open func updateView(_ size: CGFloat) { }
|
|
||||||
|
|
||||||
/// Will be called only once.
|
/// Will be called only once.
|
||||||
open func setupView() {
|
open func setup() {
|
||||||
translatesAutoresizingMaskIntoConstraints = false
|
translatesAutoresizingMaskIntoConstraints = false
|
||||||
insetsLayoutMarginsFromSafeArea = false
|
insetsLayoutMarginsFromSafeArea = false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,10 +52,10 @@ open class VDSView<ModelType: Initable>: UIView, ModelHandlerable, ViewProtocol
|
|||||||
public func initialSetup() {
|
public func initialSetup() {
|
||||||
if !initialSetupPerformed {
|
if !initialSetupPerformed {
|
||||||
initialSetupPerformed = true
|
initialSetupPerformed = true
|
||||||
setupView()
|
cancellable = $model.debounce(for: .seconds(VDSConstants.ModelStateDebounce), scheduler: RunLoop.main).sink { [weak self] viewModel in
|
||||||
}
|
self?.onStateChange(viewModel: viewModel)
|
||||||
cancellable = $model.debounce(for: .seconds(VDSConstants.ModelStateDebounce), scheduler: RunLoop.main).sink { [weak self] viewModel in
|
}
|
||||||
self?.onStateChange(viewModel: viewModel)
|
setup()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ open class VDSView<ModelType: Initable>: UIView, ModelHandlerable, ViewProtocol
|
|||||||
open func updateView(_ size: CGFloat) { }
|
open func updateView(_ size: CGFloat) { }
|
||||||
|
|
||||||
/// Will be called only once.
|
/// Will be called only once.
|
||||||
open func setupView() {
|
open func setup() {
|
||||||
translatesAutoresizingMaskIntoConstraints = false
|
translatesAutoresizingMaskIntoConstraints = false
|
||||||
insetsLayoutMarginsFromSafeArea = false
|
insetsLayoutMarginsFromSafeArea = false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,9 +19,9 @@ import Combine
|
|||||||
Knob: The circular indicator that slides on the container.
|
Knob: The circular indicator that slides on the container.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@objcMembers public class VDSCheckbox: VDSCheckboxBase<DefaultCheckboxModel>{}
|
public class VDSCheckbox: VDSCheckboxBase<DefaultCheckboxModel>{}
|
||||||
|
|
||||||
@objcMembers open class VDSCheckboxBase<ModelType: VDSCheckboxModel>: VDSControl<ModelType>, Changable {
|
open class VDSCheckboxBase<ModelType: VDSCheckboxModel>: VDSControl<ModelType>, Changable {
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
@ -185,16 +185,9 @@ import Combine
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public override func updateView(_ size: CGFloat) {
|
open override func setup() {
|
||||||
super.updateView(size)
|
super.setup()
|
||||||
|
|
||||||
checkboxHeightConstraint?.constant = checkboxSize.height
|
|
||||||
checkboxWidthConstraint?.constant = checkboxSize.width
|
|
||||||
}
|
|
||||||
|
|
||||||
public override func setupView() {
|
|
||||||
super.setupView()
|
|
||||||
self.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(VDSCheckbox.toggleAndAction)))
|
self.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(VDSCheckbox.toggleAndAction)))
|
||||||
|
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
@ -398,7 +391,7 @@ import Combine
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// This will checkbox the state of the Checkbox and execute the actionBlock if provided.
|
/// This will checkbox the state of the Checkbox and execute the actionBlock if provided.
|
||||||
public func toggleAndAction() {
|
@objc public func toggleAndAction() {
|
||||||
isOn.toggle()
|
isOn.toggle()
|
||||||
onChange?()
|
onChange?()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,9 +18,9 @@ import Combine
|
|||||||
Knob: The circular indicator that slides on the container.
|
Knob: The circular indicator that slides on the container.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@objcMembers public class VDSToggle: VDSToggleBase<DefaultToggleModel>{}
|
public class VDSToggle: VDSToggleBase<DefaultToggleModel>{}
|
||||||
|
|
||||||
@objcMembers open class VDSToggleBase<ModelType: VDSToggleModel>: VDSControl<ModelType>, Changable {
|
open class VDSToggleBase<ModelType: VDSToggleModel>: VDSControl<ModelType>, Changable {
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
@ -271,21 +271,8 @@ import Combine
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public override func updateView(_ size: CGFloat) {
|
open override func setup() {
|
||||||
super.updateView(size)
|
super.setup()
|
||||||
|
|
||||||
toggleHeightConstraint?.constant = toggleSize.height
|
|
||||||
toggleWidthConstraint?.constant = toggleSize.width
|
|
||||||
|
|
||||||
knobHeightConstraint?.constant = knobSize.height
|
|
||||||
knobWidthConstraint?.constant = knobSize.width
|
|
||||||
|
|
||||||
toggleView.layer.cornerRadius = toggleSize.height / 2.0
|
|
||||||
knobView.layer.cornerRadius = toggleSize.height / 2.0
|
|
||||||
}
|
|
||||||
|
|
||||||
public override func setupView() {
|
|
||||||
super.setupView()
|
|
||||||
|
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
accessibilityTraits = .button
|
accessibilityTraits = .button
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user