PR comments

This commit is contained in:
Pfeil, Scott Robert 2019-11-20 13:29:16 -05:00
parent c96f5050a8
commit e32b9cfdda

View File

@ -26,28 +26,20 @@ import UIKit
case .standard:
heightConstraint?.constant = 1
backgroundColor = .mfSilver()
setNeedsLayout()
layoutIfNeeded()
case .thin:
heightConstraint?.constant = 1
backgroundColor = .black
setNeedsLayout()
layoutIfNeeded()
case .medium:
heightConstraint?.constant = 2
backgroundColor = .black
setNeedsLayout()
layoutIfNeeded()
case .heavy:
heightConstraint?.constant = 4
backgroundColor = .black
setNeedsLayout()
layoutIfNeeded()
case .none:
heightConstraint?.constant = 0
setNeedsLayout()
layoutIfNeeded()
}
setNeedsLayout()
layoutIfNeeded()
}
}
@ -74,6 +66,7 @@ import UIKit
// MARK: - MVMCoreUIMoleculeViewProtocol
open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
// If no type, default to standard.
if let typeString = json?.optionalStringForKey(KeyType), let type = Style.init(rawValue: typeString) {
style = type
} else {
@ -92,16 +85,16 @@ import UIKit
}
public static func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
guard let type = json?.optionalStringForKey(KeyType) else { return 0 }
switch type {
case "thin", "standard":
return 1
case "medium":
guard let type = json?.optionalStringForKey(KeyType), let style = Style(rawValue: type) else { return 1 }
switch style {
case .none:
return 0
case .medium:
return 2
case "heavy":
case .heavy:
return 4
default:
return 0
return 1
}
}
}