Code cleaning
This commit is contained in:
parent
129a0e9241
commit
d891d7ba1a
@ -17,6 +17,8 @@ import Foundation
|
|||||||
var spaceBetweenConstant: CGFloat = 104.0
|
var spaceBetweenConstant: CGFloat = 104.0
|
||||||
var spaceBetweenViews: NSLayoutConstraint?
|
var spaceBetweenViews: NSLayoutConstraint?
|
||||||
var leftConstant: CGFloat = 32.0
|
var leftConstant: CGFloat = 32.0
|
||||||
|
var leftConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
open override func updateView(_ size: CGFloat) {
|
open override func updateView(_ size: CGFloat) {
|
||||||
super.updateView(size)
|
super.updateView(size)
|
||||||
@ -38,6 +40,7 @@ import Foundation
|
|||||||
view.addSubview(headlineBody)
|
view.addSubview(headlineBody)
|
||||||
view.addSubview(caretButton)
|
view.addSubview(caretButton)
|
||||||
|
|
||||||
|
//Headline view
|
||||||
headlineBody.translatesAutoresizingMaskIntoConstraints = false
|
headlineBody.translatesAutoresizingMaskIntoConstraints = false
|
||||||
headlineBody.topAnchor.constraint(equalTo: view.topAnchor, constant: 24.0).isActive = true
|
headlineBody.topAnchor.constraint(equalTo: view.topAnchor, constant: 24.0).isActive = true
|
||||||
headlineBody.leftAnchor.constraint(equalTo: view.leftAnchor, constant: leftConstant).isActive = true
|
headlineBody.leftAnchor.constraint(equalTo: view.leftAnchor, constant: leftConstant).isActive = true
|
||||||
@ -48,6 +51,7 @@ import Foundation
|
|||||||
spaceBetweenViews = caretButton.topAnchor.constraint(equalTo: headlineBody.bottomAnchor, constant: spaceBetweenConstant)
|
spaceBetweenViews = caretButton.topAnchor.constraint(equalTo: headlineBody.bottomAnchor, constant: spaceBetweenConstant)
|
||||||
spaceBetweenViews?.isActive = true
|
spaceBetweenViews?.isActive = true
|
||||||
|
|
||||||
|
//Caret view
|
||||||
caretButton.translatesAutoresizingMaskIntoConstraints = false
|
caretButton.translatesAutoresizingMaskIntoConstraints = false
|
||||||
caretButton.leftAnchor.constraint(equalTo: view.leftAnchor, constant: leftConstant).isActive = true
|
caretButton.leftAnchor.constraint(equalTo: view.leftAnchor, constant: leftConstant).isActive = true
|
||||||
view.bottomAnchor.constraint(equalTo: caretButton.bottomAnchor).isActive = true
|
view.bottomAnchor.constraint(equalTo: caretButton.bottomAnchor).isActive = true
|
||||||
@ -76,17 +80,15 @@ import Foundation
|
|||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
if let imageJSON = json?.optionalDictionaryForKey("image") {
|
backgroundImageView.setWithJSON(json?.optionalDictionaryForKey("image"), delegateObject: delegateObject, additionalData: additionalData)
|
||||||
backgroundImageView.setWithJSON(imageJSON, delegateObject: delegateObject, additionalData: additionalData)
|
|
||||||
}
|
|
||||||
headlineBody.setWithJSON(json?.optionalDictionaryForKey("headlineBody"), delegateObject: delegateObject, additionalData: additionalData)
|
headlineBody.setWithJSON(json?.optionalDictionaryForKey("headlineBody"), delegateObject: delegateObject, additionalData: additionalData)
|
||||||
caretButton.setWithJSON(json?.optionalDictionaryForKey("caretLink"), delegateObject: delegateObject, additionalData: additionalData)
|
caretButton.setWithJSON(json?.optionalDictionaryForKey("caretLink"), delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
headlineBody.reset()
|
headlineBody.reset()
|
||||||
|
backgroundImageView.reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user