Removes self where unnecessary

This commit is contained in:
Robinson, Blake 2019-12-19 12:23:18 -05:00
parent 7c17889b57
commit 6e233e9bab

View File

@ -19,21 +19,21 @@ import UIKit
public override init(frame: CGRect) { public override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
self.setupView() setupView()
} }
public required init?(coder: NSCoder) { public required init?(coder: NSCoder) {
super.init(coder: coder) super.init(coder: coder)
self.setupView() setupView()
} }
open override func draw(_ rect: CGRect) { open override func draw(_ rect: CGRect) {
guard let textRect = self.titleLabel?.frame else { return } guard let textRect = titleLabel?.frame else { return }
let contextRef = UIGraphicsGetCurrentContext() let contextRef = UIGraphicsGetCurrentContext()
//set to the same color as the text //set to the same color as the text
if let color = self.titleLabel?.textColor?.cgColor { if let color = titleLabel?.textColor?.cgColor {
contextRef?.setStrokeColor(color) contextRef?.setStrokeColor(color)
} }
@ -89,7 +89,7 @@ extension Link: MVMCoreViewProtocol {
titleLabel?.textAlignment = .left titleLabel?.textAlignment = .left
contentHorizontalAlignment = .left contentHorizontalAlignment = .left
if let constant = self.sizeObject?.standardSize { if let constant = sizeObject?.standardSize {
let heightConstraint = NSLayoutConstraint(item: self as Any, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: constant) let heightConstraint = NSLayoutConstraint(item: self as Any, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: constant)
addConstraint(heightConstraint) addConstraint(heightConstraint)
heightConstraint.isActive = true heightConstraint.isActive = true
@ -101,7 +101,7 @@ extension Link: MVMCoreViewProtocol {
extension Link: MVMCoreUIMoleculeViewProtocol { extension Link: MVMCoreUIMoleculeViewProtocol {
public func reset() { public func reset() {
self.setTitleColor(.mfTextButton(), for: .normal) setTitleColor(.mfTextButton(), for: .normal)
} }
public func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { public func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
@ -123,9 +123,9 @@ extension Link: MVMCoreUIMoleculeViewProtocol {
} }
} }
if let title = self.title(for: .normal), if let title = title(for: .normal),
title.isEmpty { title.isEmpty {
self.heightConstraint?.constant = 0 heightConstraint?.constant = 0
} else { } else {
guard let standardSize = sizeObject?.standardSize else { return } guard let standardSize = sizeObject?.standardSize else { return }
heightConstraint?.constant = standardSize heightConstraint?.constant = standardSize