correcting errors. Improving Control.
This commit is contained in:
parent
335649860b
commit
ed18970625
@ -11,7 +11,7 @@ import MVMCore
|
|||||||
/**
|
/**
|
||||||
This class expects its height and width to be equal.
|
This class expects its height and width to be equal.
|
||||||
*/
|
*/
|
||||||
@objcMembers open class Checkbox: UIControl, MVMCoreViewProtocol, MVMCoreUIMoleculeViewProtocol, MVMCoreUIViewConstrainingProtocol {
|
@objcMembers open class Checkbox: Control, MVMCoreUIViewConstrainingProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -149,7 +149,7 @@ import MVMCore
|
|||||||
fatalError("xib file is not implemented for Checkbox.")
|
fatalError("xib file is not implemented for Checkbox.")
|
||||||
}
|
}
|
||||||
|
|
||||||
public convenience init() {
|
public convenience override init() {
|
||||||
self.init(frame:.zero)
|
self.init(frame:.zero)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +182,8 @@ import MVMCore
|
|||||||
layer.borderColor = borderColor.cgColor
|
layer.borderColor = borderColor.cgColor
|
||||||
}
|
}
|
||||||
|
|
||||||
open func setupView() {
|
open override func setupView() {
|
||||||
|
super.setupView()
|
||||||
|
|
||||||
guard constraints.isEmpty else { return }
|
guard constraints.isEmpty else { return }
|
||||||
|
|
||||||
@ -374,7 +375,8 @@ import MVMCore
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
open func reset() {
|
open override func reset() {
|
||||||
|
super.reset()
|
||||||
|
|
||||||
isEnabled(true)
|
isEnabled(true)
|
||||||
shapeLayer?.removeAllAnimations()
|
shapeLayer?.removeAllAnimations()
|
||||||
@ -394,7 +396,8 @@ import MVMCore
|
|||||||
setupView()
|
setupView()
|
||||||
}
|
}
|
||||||
|
|
||||||
public func updateView(_ size: CGFloat) {
|
public override func updateView(_ size: CGFloat) {
|
||||||
|
super.updateView(size)
|
||||||
|
|
||||||
if let dimension = sizeObject?.getValueBased(onSize: size) {
|
if let dimension = sizeObject?.getValueBased(onSize: size) {
|
||||||
widthConstraint?.constant = dimension
|
widthConstraint?.constant = dimension
|
||||||
@ -404,7 +407,8 @@ import MVMCore
|
|||||||
layoutIfNeeded()
|
layoutIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
public func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
public override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
self.delegateObject = delegateObject
|
self.delegateObject = delegateObject
|
||||||
FormValidator.setupValidation(molecule: self, delegate: delegateObject?.formValidationProtocol)
|
FormValidator.setupValidation(molecule: self, delegate: delegateObject?.formValidationProtocol)
|
||||||
|
|
||||||
|
|||||||
@ -8,17 +8,25 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public class Control: UIControl {
|
@objcMembers open class Control: UIControl {
|
||||||
var json: [AnyHashable: Any]?
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
public var json: [AnyHashable: Any]?
|
||||||
|
|
||||||
private var initialSetupPerformed = false
|
private var initialSetupPerformed = false
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializers
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
public override init(frame: CGRect) {
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
initialSetup()
|
initialSetup()
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
public init() {
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
initialSetup()
|
initialSetup()
|
||||||
}
|
}
|
||||||
@ -28,6 +36,10 @@ public class Control: UIControl {
|
|||||||
initialSetup()
|
initialSetup()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Setup
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func initialSetup() {
|
public func initialSetup() {
|
||||||
if !initialSetupPerformed {
|
if !initialSetupPerformed {
|
||||||
initialSetupPerformed = true
|
initialSetupPerformed = true
|
||||||
@ -36,7 +48,9 @@ public class Control: UIControl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - MVMCoreViewProtocol
|
||||||
extension Control: MVMCoreViewProtocol {
|
extension Control: MVMCoreViewProtocol {
|
||||||
|
|
||||||
public func updateView(_ size: CGFloat) {
|
public func updateView(_ size: CGFloat) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +61,7 @@ extension Control: MVMCoreViewProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
extension Control: MVMCoreUIMoleculeViewProtocol {
|
extension Control: MVMCoreUIMoleculeViewProtocol {
|
||||||
public func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
public func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||||
self.json = json
|
self.json = json
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user