Used guard instead of if let because some code after the if let was removed

This commit is contained in:
Robinson, Blake 2019-12-19 13:38:51 -05:00
parent 8d417068a9
commit 87613fb375

View File

@ -89,7 +89,7 @@ extension Link: MVMCoreUIMoleculeViewProtocol {
} }
public func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { public func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
if let unwrappedJson = json { guard let unwrappedJson = json else { return }
actionMap = unwrappedJson actionMap = unwrappedJson
self.additionalData = additionalData self.additionalData = additionalData
self.delegateObject = delegateObject self.delegateObject = delegateObject
@ -100,13 +100,12 @@ extension Link: MVMCoreUIMoleculeViewProtocol {
titleLabel?.numberOfLines = 0 titleLabel?.numberOfLines = 0
titleLabel?.lineBreakMode = .byWordWrapping; titleLabel?.lineBreakMode = .byWordWrapping;
setTitle(actionMap?.stringForkey(KeyTitle), for: .normal) setTitle(unwrappedJson.stringForkey(KeyTitle), for: .normal)
if let enabled = unwrappedJson[KeyEnabled] as? Bool { if let enabled = unwrappedJson[KeyEnabled] as? Bool {
isEnabled = enabled isEnabled = enabled
} }
} }
}
public static func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { public static func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
return 31 return 31