PR comments
This commit is contained in:
parent
c96f5050a8
commit
e32b9cfdda
@ -26,28 +26,20 @@ import UIKit
|
|||||||
case .standard:
|
case .standard:
|
||||||
heightConstraint?.constant = 1
|
heightConstraint?.constant = 1
|
||||||
backgroundColor = .mfSilver()
|
backgroundColor = .mfSilver()
|
||||||
setNeedsLayout()
|
|
||||||
layoutIfNeeded()
|
|
||||||
case .thin:
|
case .thin:
|
||||||
heightConstraint?.constant = 1
|
heightConstraint?.constant = 1
|
||||||
backgroundColor = .black
|
backgroundColor = .black
|
||||||
setNeedsLayout()
|
|
||||||
layoutIfNeeded()
|
|
||||||
case .medium:
|
case .medium:
|
||||||
heightConstraint?.constant = 2
|
heightConstraint?.constant = 2
|
||||||
backgroundColor = .black
|
backgroundColor = .black
|
||||||
setNeedsLayout()
|
|
||||||
layoutIfNeeded()
|
|
||||||
case .heavy:
|
case .heavy:
|
||||||
heightConstraint?.constant = 4
|
heightConstraint?.constant = 4
|
||||||
backgroundColor = .black
|
backgroundColor = .black
|
||||||
setNeedsLayout()
|
|
||||||
layoutIfNeeded()
|
|
||||||
case .none:
|
case .none:
|
||||||
heightConstraint?.constant = 0
|
heightConstraint?.constant = 0
|
||||||
setNeedsLayout()
|
|
||||||
layoutIfNeeded()
|
|
||||||
}
|
}
|
||||||
|
setNeedsLayout()
|
||||||
|
layoutIfNeeded()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,6 +66,7 @@ import UIKit
|
|||||||
// 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]?) {
|
||||||
|
|
||||||
|
// If no type, default to standard.
|
||||||
if let typeString = json?.optionalStringForKey(KeyType), let type = Style.init(rawValue: typeString) {
|
if let typeString = json?.optionalStringForKey(KeyType), let type = Style.init(rawValue: typeString) {
|
||||||
style = type
|
style = type
|
||||||
} else {
|
} else {
|
||||||
@ -92,16 +85,16 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
public static func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||||
guard let type = json?.optionalStringForKey(KeyType) else { return 0 }
|
guard let type = json?.optionalStringForKey(KeyType), let style = Style(rawValue: type) else { return 1 }
|
||||||
switch type {
|
switch style {
|
||||||
case "thin", "standard":
|
case .none:
|
||||||
return 1
|
return 0
|
||||||
case "medium":
|
case .medium:
|
||||||
return 2
|
return 2
|
||||||
case "heavy":
|
case .heavy:
|
||||||
return 4
|
return 4
|
||||||
default:
|
default:
|
||||||
return 0
|
return 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user